CHROMIUM: drm: bridge/dw_hdmi: assign CD field to zero
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / max8925-i2c.c
index c94d3337bdfdf83cc805e04c1f25d6488b1cbaf0..b0fe8103e401e66e10629d462733790d44c5bd5a 100644 (file)
@@ -37,7 +37,7 @@ static inline int max8925_read_device(struct i2c_client *i2c,
 static inline int max8925_write_device(struct i2c_client *i2c,
                                       int reg, int bytes, void *src)
 {
-       unsigned char buf[bytes + 1];
+       unsigned char buf[9];
        int ret;
 
        buf[0] = (unsigned char)reg;
@@ -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;
@@ -208,7 +209,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;
 }
 
@@ -245,9 +245,8 @@ MODULE_DEVICE_TABLE(of, max8925_dt_ids);
 static struct i2c_driver max8925_driver = {
        .driver = {
                .name   = "max8925",
-               .owner  = THIS_MODULE,
                .pm     = &max8925_pm_ops,
-               .of_match_table = of_match_ptr(max8925_dt_ids),
+               .of_match_table = max8925_dt_ids,
        },
        .probe          = max8925_probe,
        .remove         = max8925_remove,
@@ -257,9 +256,11 @@ static struct i2c_driver max8925_driver = {
 static int __init max8925_i2c_init(void)
 {
        int ret;
+
        ret = i2c_add_driver(&max8925_driver);
        if (ret != 0)
                pr_err("Failed to register MAX8925 I2C driver: %d\n", ret);
+
        return ret;
 }
 subsys_initcall(max8925_i2c_init);