Commit ff2b7ac6 authored by Axel Lin's avatar Axel Lin Committed by Samuel Ortiz

mfd: Fix max77693 irq leak and wrong kfree call

We need to call max77693_irq_exit() in max77693_i2c_probe error patch and
max77693_i2c_remove.

Current code already uses devm_kzalloc() to allocate memory for max77693.
Thus we should not call kfree(max77693), otherwise we got double free.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 8b7353d1
...@@ -154,7 +154,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -154,7 +154,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
ret = max77693_irq_init(max77693); ret = max77693_irq_init(max77693);
if (ret < 0) if (ret < 0)
goto err_mfd; goto err_irq;
pm_runtime_set_active(max77693->dev); pm_runtime_set_active(max77693->dev);
...@@ -168,11 +168,11 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -168,11 +168,11 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
err_mfd: err_mfd:
max77693_irq_exit(max77693);
err_irq:
i2c_unregister_device(max77693->muic); i2c_unregister_device(max77693->muic);
i2c_unregister_device(max77693->haptic); i2c_unregister_device(max77693->haptic);
err_regmap: err_regmap:
kfree(max77693);
return ret; return ret;
} }
...@@ -181,6 +181,7 @@ static int max77693_i2c_remove(struct i2c_client *i2c) ...@@ -181,6 +181,7 @@ static int max77693_i2c_remove(struct i2c_client *i2c)
struct max77693_dev *max77693 = i2c_get_clientdata(i2c); struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
mfd_remove_devices(max77693->dev); mfd_remove_devices(max77693->dev);
max77693_irq_exit(max77693);
i2c_unregister_device(max77693->muic); i2c_unregister_device(max77693->muic);
i2c_unregister_device(max77693->haptic); i2c_unregister_device(max77693->haptic);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment