diff options
-rw-r--r-- | drivers/mfd/tps6507x.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index 1b203499c74..409afa23d5d 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c | |||
@@ -86,9 +86,9 @@ static int tps6507x_i2c_probe(struct i2c_client *i2c, | |||
86 | const struct i2c_device_id *id) | 86 | const struct i2c_device_id *id) |
87 | { | 87 | { |
88 | struct tps6507x_dev *tps6507x; | 88 | struct tps6507x_dev *tps6507x; |
89 | int ret = 0; | ||
90 | 89 | ||
91 | tps6507x = kzalloc(sizeof(struct tps6507x_dev), GFP_KERNEL); | 90 | tps6507x = devm_kzalloc(&i2c->dev, sizeof(struct tps6507x_dev), |
91 | GFP_KERNEL); | ||
92 | if (tps6507x == NULL) | 92 | if (tps6507x == NULL) |
93 | return -ENOMEM; | 93 | return -ENOMEM; |
94 | 94 | ||
@@ -98,19 +98,8 @@ static int tps6507x_i2c_probe(struct i2c_client *i2c, | |||
98 | tps6507x->read_dev = tps6507x_i2c_read_device; | 98 | tps6507x->read_dev = tps6507x_i2c_read_device; |
99 | tps6507x->write_dev = tps6507x_i2c_write_device; | 99 | tps6507x->write_dev = tps6507x_i2c_write_device; |
100 | 100 | ||
101 | ret = mfd_add_devices(tps6507x->dev, -1, | 101 | return mfd_add_devices(tps6507x->dev, -1, tps6507x_devs, |
102 | tps6507x_devs, ARRAY_SIZE(tps6507x_devs), | 102 | ARRAY_SIZE(tps6507x_devs), NULL, 0, NULL); |
103 | NULL, 0, NULL); | ||
104 | |||
105 | if (ret < 0) | ||
106 | goto err; | ||
107 | |||
108 | return ret; | ||
109 | |||
110 | err: | ||
111 | mfd_remove_devices(tps6507x->dev); | ||
112 | kfree(tps6507x); | ||
113 | return ret; | ||
114 | } | 103 | } |
115 | 104 | ||
116 | static int tps6507x_i2c_remove(struct i2c_client *i2c) | 105 | static int tps6507x_i2c_remove(struct i2c_client *i2c) |
@@ -118,8 +107,6 @@ static int tps6507x_i2c_remove(struct i2c_client *i2c) | |||
118 | struct tps6507x_dev *tps6507x = i2c_get_clientdata(i2c); | 107 | struct tps6507x_dev *tps6507x = i2c_get_clientdata(i2c); |
119 | 108 | ||
120 | mfd_remove_devices(tps6507x->dev); | 109 | mfd_remove_devices(tps6507x->dev); |
121 | kfree(tps6507x); | ||
122 | |||
123 | return 0; | 110 | return 0; |
124 | } | 111 | } |
125 | 112 | ||