--- zzzz-none-000/linux-3.10.107/drivers/mfd/max8925-i2c.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/mfd/max8925-i2c.c 2021-02-04 17:41:59.000000000 +0000 @@ -37,7 +37,7 @@ 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_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 @@ 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 @@ max8925_device_exit(chip); i2c_unregister_device(chip->adc); i2c_unregister_device(chip->rtc); - kfree(chip); return 0; } @@ -245,9 +245,8 @@ 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 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);