提交 02c7d848 编写于 作者: L Lee Jones 提交者: Samuel Ortiz

mfd: max8925: Convert to managed resources for allocating memory

Signed-off-by: NLee Jones <lee.jones@linaro.org>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 742413a4
...@@ -170,7 +170,8 @@ static int max8925_probe(struct i2c_client *client, ...@@ -170,7 +170,8 @@ static int max8925_probe(struct i2c_client *client,
return -EINVAL; return -EINVAL;
} }
chip = kzalloc(sizeof(struct max8925_chip), GFP_KERNEL); chip = devm_kzalloc(&client->dev,
sizeof(struct max8925_chip), GFP_KERNEL);
if (chip == NULL) if (chip == NULL)
return -ENOMEM; return -ENOMEM;
chip->i2c = client; chip->i2c = client;
...@@ -199,7 +200,6 @@ static int max8925_remove(struct i2c_client *client) ...@@ -199,7 +200,6 @@ static int max8925_remove(struct i2c_client *client)
max8925_device_exit(chip); max8925_device_exit(chip);
i2c_unregister_device(chip->adc); i2c_unregister_device(chip->adc);
i2c_unregister_device(chip->rtc); i2c_unregister_device(chip->rtc);
kfree(chip);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册