]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - drivers/mfd/max8925-i2c.c
mfd: Use dev_get_platdata()
[mirror_ubuntu-focal-kernel.git] / drivers / mfd / max8925-i2c.c
index 92bbebd31598815659e667d890a846249b37db8b..de7fb80a60528e8f3bcbc2c45e934dcfa5a65181 100644 (file)
@@ -151,7 +151,7 @@ static int max8925_dt_init(struct device_node *np, struct device *dev,
 static int max8925_probe(struct i2c_client *client,
                                   const struct i2c_device_id *id)
 {
-       struct max8925_platform_data *pdata = client->dev.platform_data;
+       struct max8925_platform_data *pdata = dev_get_platdata(&client->dev);
        static struct max8925_chip *chip;
        struct device_node *node = client->dev.of_node;
 
@@ -170,7 +170,8 @@ static int max8925_probe(struct i2c_client *client,
                return -EINVAL;
        }
 
-       chip = kzalloc(sizeof(struct max8925_chip), GFP_KERNEL);
+       chip = devm_kzalloc(&client->dev,
+                           sizeof(struct max8925_chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        chip->i2c = client;
@@ -199,7 +200,6 @@ static int max8925_remove(struct i2c_client *client)
        max8925_device_exit(chip);
        i2c_unregister_device(chip->adc);
        i2c_unregister_device(chip->rtc);
-       kfree(chip);
        return 0;
 }