aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:58:02 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:30 -0400
commit64adf39837c7cf744161b18598577cbe2467a01d (patch)
tree15f6b3cfc70380c60729c9ba46389b78d04c6407 /drivers/hwmon
parentf9286434ea64803b673bb4ec0dd7084b13c2d90b (diff)
hwmon: (asb100) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/asb100.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 4b8814deabb1..a227be47149f 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -787,12 +787,10 @@ static int asb100_probe(struct i2c_client *client,
787 int err; 787 int err;
788 struct asb100_data *data; 788 struct asb100_data *data;
789 789
790 data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL); 790 data = devm_kzalloc(&client->dev, sizeof(struct asb100_data),
791 if (!data) { 791 GFP_KERNEL);
792 pr_debug("probe failed, kzalloc failed!\n"); 792 if (!data)
793 err = -ENOMEM; 793 return -ENOMEM;
794 goto ERROR0;
795 }
796 794
797 i2c_set_clientdata(client, data); 795 i2c_set_clientdata(client, data);
798 mutex_init(&data->lock); 796 mutex_init(&data->lock);
@@ -801,7 +799,7 @@ static int asb100_probe(struct i2c_client *client,
801 /* Attach secondary lm75 clients */ 799 /* Attach secondary lm75 clients */
802 err = asb100_detect_subclients(client); 800 err = asb100_detect_subclients(client);
803 if (err) 801 if (err)
804 goto ERROR1; 802 return err;
805 803
806 /* Initialize the chip */ 804 /* Initialize the chip */
807 asb100_init_client(client); 805 asb100_init_client(client);
@@ -829,9 +827,6 @@ ERROR4:
829ERROR3: 827ERROR3:
830 i2c_unregister_device(data->lm75[1]); 828 i2c_unregister_device(data->lm75[1]);
831 i2c_unregister_device(data->lm75[0]); 829 i2c_unregister_device(data->lm75[0]);
832ERROR1:
833 kfree(data);
834ERROR0:
835 return err; 830 return err;
836} 831}
837 832
@@ -845,8 +840,6 @@ static int asb100_remove(struct i2c_client *client)
845 i2c_unregister_device(data->lm75[1]); 840 i2c_unregister_device(data->lm75[1]);
846 i2c_unregister_device(data->lm75[0]); 841 i2c_unregister_device(data->lm75[0]);
847 842
848 kfree(data);
849
850 return 0; 843 return 0;
851} 844}
852 845