i2c device client shouldn't be freed by i2c device driver, there have
problems in below cases:
- one device match to different drivers, the second matched driver will
cannot access i2c device client if it is freed by the first matched driver.
- one module driver insmod: the first insmod fail free client due to system
low memory, after kswapd system free pages and has enough free pages, the
second insmod will cause match failed.
Signed-off-by: Fugang Duan <B38611@freescale.com>
/* Create the PMIC data structure */
max17135 = kzalloc(sizeof(struct max17135), GFP_KERNEL);
- if (max17135 == NULL) {
- kfree(client);
+ if (max17135 == NULL)
return -ENOMEM;
- }
/* Initialize the PMIC data structure */
i2c_set_clientdata(client, max17135);