• Krzysztof Kozlowski's avatar
    regmap: irq: Set data pointer only on regmap_add_irq_chip success · 72a6a5df
    Krzysztof Kozlowski authored
    After setting the 'data' pointer (wchich is returned to the caller for
    freeing later) the regmap_add_irq_chip() could still fail for various
    reasons (ENOMEM, regmap_read or regmap_write failure). In such case the
    memory under 'data' was freed in error path and error value was returned
    but the 'data' variable was not changed.
    
    This could lead to errors if the caller passed such 'data' to
    regmap_del_irq_chip().
    
    The 'data' pointer should be changed atomically from the caller
    perspective - set it only on regmap_add_irq_chip() success.
    Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
    Signed-off-by: default avatarMark Brown <broonie@linaro.org>
    72a6a5df
regmap-irq.c 14.6 KB