Skip to content

Commit c243382

Browse files
committed
Input: cyapa - switch to using devm_device_add_group()
Instead of installing custom devm cleanup action to remove attribute groups on failure, let's use the dedicated devm API. Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 2e75cfa commit c243382

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

drivers/input/mouse/cyapa.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,13 +1238,6 @@ static const struct attribute_group cyapa_sysfs_group = {
12381238
.attrs = cyapa_sysfs_entries,
12391239
};
12401240

1241-
static void cyapa_remove_sysfs_group(void *data)
1242-
{
1243-
struct cyapa *cyapa = data;
1244-
1245-
sysfs_remove_group(&cyapa->client->dev.kobj, &cyapa_sysfs_group);
1246-
}
1247-
12481241
static void cyapa_disable_regulator(void *data)
12491242
{
12501243
struct cyapa *cyapa = data;
@@ -1312,19 +1305,12 @@ static int cyapa_probe(struct i2c_client *client,
13121305
return error;
13131306
}
13141307

1315-
error = sysfs_create_group(&dev->kobj, &cyapa_sysfs_group);
1308+
error = devm_device_add_group(dev, &cyapa_sysfs_group);
13161309
if (error) {
13171310
dev_err(dev, "failed to create sysfs entries: %d\n", error);
13181311
return error;
13191312
}
13201313

1321-
error = devm_add_action(dev, cyapa_remove_sysfs_group, cyapa);
1322-
if (error) {
1323-
cyapa_remove_sysfs_group(cyapa);
1324-
dev_err(dev, "failed to add sysfs cleanup action: %d\n", error);
1325-
return error;
1326-
}
1327-
13281314
error = cyapa_prepare_wakeup_controls(cyapa);
13291315
if (error) {
13301316
dev_err(dev, "failed to prepare wakeup controls: %d\n", error);

0 commit comments

Comments
 (0)