[i2c] [PATCH] i2c/tps65010: Add missing intialization of client data

Jean Delvare khali at linux-fr.org
Sun Apr 27 20:16:22 CEST 2008


tps65010_remove() calls i2c_get_clientdata(client) but the client data
is never set during initialization, so it gets a NULL pointer at best.

I guess it was never spotted because the tps65010 driver is typically
not built modular so this function is discarded.

Signed-off-by: Jean Delvare <khali at linux-fr.org>
Cc: David Brownell <dbrownell at users.sourceforge.net>
---
 drivers/i2c/chips/tps65010.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.26-rc0.orig/drivers/i2c/chips/tps65010.c	2008-04-27 20:03:14.000000000 +0200
+++ linux-2.6.26-rc0/drivers/i2c/chips/tps65010.c	2008-04-27 20:05:23.000000000 +0200
@@ -527,6 +527,7 @@ static int __exit tps65010_remove(struct
 	flush_scheduled_work();
 	debugfs_remove(tps->file);
 	kfree(tps);
+	i2c_set_clientdata(client, NULL);
 	the_tps = NULL;
 	return 0;
 }
@@ -616,6 +617,7 @@ static int tps65010_probe(struct i2c_cli
 		i2c_smbus_read_byte_data(client, TPS_DEFGPIO),
 		i2c_smbus_read_byte_data(client, TPS_MASK3));
 
+	i2c_set_clientdata(client, tps);
 	the_tps = tps;
 
 #if	defined(CONFIG_USB_GADGET) && !defined(CONFIG_USB_OTG)


-- 
Jean Delvare



More information about the i2c mailing list