aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/pca9539.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/pca9539.c')
-rw-r--r--drivers/i2c/chips/pca9539.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c
index cb22280cdd27..f43c4e79b55e 100644
--- a/drivers/i2c/chips/pca9539.c
+++ b/drivers/i2c/chips/pca9539.c
@@ -148,11 +148,16 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind)
148 if ((err = i2c_attach_client(new_client))) 148 if ((err = i2c_attach_client(new_client)))
149 goto exit_kfree; 149 goto exit_kfree;
150 150
151 /* Register sysfs hooks (don't care about failure) */ 151 /* Register sysfs hooks */
152 sysfs_create_group(&new_client->dev.kobj, &pca9539_defattr_group); 152 err = sysfs_create_group(&new_client->dev.kobj,
153 &pca9539_defattr_group);
154 if (err)
155 goto exit_detach;
153 156
154 return 0; 157 return 0;
155 158
159exit_detach:
160 i2c_detach_client(new_client);
156exit_kfree: 161exit_kfree:
157 kfree(data); 162 kfree(data);
158exit: 163exit:
@@ -163,6 +168,8 @@ static int pca9539_detach_client(struct i2c_client *client)
163{ 168{
164 int err; 169 int err;
165 170
171 sysfs_remove_group(&client->dev.kobj, &pca9539_defattr_group);
172
166 if ((err = i2c_detach_client(client))) 173 if ((err = i2c_detach_client(client)))
167 return err; 174 return err;
168 175