mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
mfd: sec-core: Fix I2C dummy device resource leak on probe failure
Dummy I2C device allocated in sec_pmic_probe() leaked if devm_regmap_init_i2c() failed. Unregister it before returning from probe. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Sachin Kamat <[email protected]> Signed-off-by: Lee Jones <[email protected]>
This commit is contained in:
parent
53c31b3437
commit
8c66eeced1
1 changed files with 4 additions and 3 deletions
|
|
@ -347,7 +347,7 @@ static int sec_pmic_probe(struct i2c_client *i2c,
|
|||
ret = PTR_ERR(sec_pmic->regmap_rtc);
|
||||
dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
goto err_regmap_rtc;
|
||||
}
|
||||
|
||||
if (pdata && pdata->cfg_pmic_irq)
|
||||
|
|
@ -388,14 +388,15 @@ static int sec_pmic_probe(struct i2c_client *i2c,
|
|||
}
|
||||
|
||||
if (ret)
|
||||
goto err;
|
||||
goto err_mfd;
|
||||
|
||||
device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
|
||||
|
||||
return ret;
|
||||
|
||||
err:
|
||||
err_mfd:
|
||||
sec_irq_exit(sec_pmic);
|
||||
err_regmap_rtc:
|
||||
i2c_unregister_device(sec_pmic->rtc);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue