diff options
Diffstat (limited to 'drivers/mfd/wm8350-i2c.c')
-rw-r--r-- | drivers/mfd/wm8350-i2c.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c index 65830f57c093..7795af4b1fe1 100644 --- a/drivers/mfd/wm8350-i2c.c +++ b/drivers/mfd/wm8350-i2c.c | |||
@@ -64,10 +64,8 @@ static int wm8350_i2c_probe(struct i2c_client *i2c, | |||
64 | int ret = 0; | 64 | int ret = 0; |
65 | 65 | ||
66 | wm8350 = kzalloc(sizeof(struct wm8350), GFP_KERNEL); | 66 | wm8350 = kzalloc(sizeof(struct wm8350), GFP_KERNEL); |
67 | if (wm8350 == NULL) { | 67 | if (wm8350 == NULL) |
68 | kfree(i2c); | ||
69 | return -ENOMEM; | 68 | return -ENOMEM; |
70 | } | ||
71 | 69 | ||
72 | i2c_set_clientdata(i2c, wm8350); | 70 | i2c_set_clientdata(i2c, wm8350); |
73 | wm8350->dev = &i2c->dev; | 71 | wm8350->dev = &i2c->dev; |
@@ -82,6 +80,7 @@ static int wm8350_i2c_probe(struct i2c_client *i2c, | |||
82 | return ret; | 80 | return ret; |
83 | 81 | ||
84 | err: | 82 | err: |
83 | i2c_set_clientdata(i2c, NULL); | ||
85 | kfree(wm8350); | 84 | kfree(wm8350); |
86 | return ret; | 85 | return ret; |
87 | } | 86 | } |
@@ -91,6 +90,7 @@ static int wm8350_i2c_remove(struct i2c_client *i2c) | |||
91 | struct wm8350 *wm8350 = i2c_get_clientdata(i2c); | 90 | struct wm8350 *wm8350 = i2c_get_clientdata(i2c); |
92 | 91 | ||
93 | wm8350_device_exit(wm8350); | 92 | wm8350_device_exit(wm8350); |
93 | i2c_set_clientdata(i2c, NULL); | ||
94 | kfree(wm8350); | 94 | kfree(wm8350); |
95 | 95 | ||
96 | return 0; | 96 | return 0; |