Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326183
b: refs/heads/master
c: a844af1
h: refs/heads/master
i:
  326181: ca264b1
  326179: 441d43e
  326175: 75152c3
v: v3
  • Loading branch information
Guenter Roeck committed Sep 24, 2012
1 parent df99d85 commit 1e52aca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38fe7560a391cba81ec7fc5b169b764819632060
refs/heads/master: a844af19b9a8c3bcd1169f60916b0f7c40b6295f
13 changes: 4 additions & 9 deletions trunk/drivers/hwmon/sht21.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,18 @@ static int __devinit sht21_probe(struct i2c_client *client,
return -ENODEV;
}

sht21 = kzalloc(sizeof(*sht21), GFP_KERNEL);
if (!sht21) {
dev_dbg(&client->dev, "kzalloc failed\n");
sht21 = devm_kzalloc(&client->dev, sizeof(*sht21), GFP_KERNEL);
if (!sht21)
return -ENOMEM;
}

i2c_set_clientdata(client, sht21);

mutex_init(&sht21->lock);

err = sysfs_create_group(&client->dev.kobj, &sht21_attr_group);
if (err) {
dev_dbg(&client->dev, "could not create sysfs files\n");
goto fail_free;
return err;
}
sht21->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(sht21->hwmon_dev)) {
Expand All @@ -226,9 +225,6 @@ static int __devinit sht21_probe(struct i2c_client *client,

fail_remove_sysfs:
sysfs_remove_group(&client->dev.kobj, &sht21_attr_group);
fail_free:
kfree(sht21);

return err;
}

Expand All @@ -242,7 +238,6 @@ static int __devexit sht21_remove(struct i2c_client *client)

hwmon_device_unregister(sht21->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &sht21_attr_group);
kfree(sht21);

return 0;
}
Expand Down

0 comments on commit 1e52aca

Please sign in to comment.