From: Samu Onkalo Date: Fri, 22 Oct 2010 11:57:34 +0000 (-0400) Subject: hwmon: lis3: Release resources in case of failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b11e7b3f3b56119194234085d42a633ceabd6aba;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hwmon: lis3: Release resources in case of failure If lis3lv02d_init_device fails, HW resources were not released properly. In case of failure call release_resources if available. Signed-off-by: Samu Onkalo Acked-by: Eric Piel Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/lis3lv02d_i2c.c b/drivers/hwmon/lis3lv02d_i2c.c index 0074809917a2..9f4bae07f719 100644 --- a/drivers/hwmon/lis3lv02d_i2c.c +++ b/drivers/hwmon/lis3lv02d_i2c.c @@ -160,7 +160,12 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, if (lis3_dev.reg_ctrl) lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF); + + if (ret == 0) + return 0; fail: + if (pdata && pdata->release_resources) + pdata->release_resources(); return ret; }