提交 0010dd38 编写于 作者: J Jingoo Han 提交者: Lee Jones

mfd: max8998: Use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
上级 6922ffcf
......@@ -188,7 +188,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
struct max8998_dev *max8998;
int ret = 0;
max8998 = kzalloc(sizeof(struct max8998_dev), GFP_KERNEL);
max8998 = devm_kzalloc(&i2c->dev, sizeof(struct max8998_dev),
GFP_KERNEL);
if (max8998 == NULL)
return -ENOMEM;
......@@ -246,7 +247,6 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
mfd_remove_devices(max8998->dev);
max8998_irq_exit(max8998);
i2c_unregister_device(max8998->rtc);
kfree(max8998);
return ret;
}
......@@ -257,7 +257,6 @@ static int max8998_i2c_remove(struct i2c_client *i2c)
mfd_remove_devices(max8998->dev);
max8998_irq_exit(max8998);
i2c_unregister_device(max8998->rtc);
kfree(max8998);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册