summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-max732x.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2019-05-21 12:03:06 +0300
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2019-05-31 10:33:33 +0300
commit2674700c4c0ec3bdeb1cd0ff4bf51ede2bc51c16 (patch)
treee9d399ecdebc8f2e86aa532e8dc86fa9b7ea5c99 /drivers/gpio/gpio-max732x.c
parent375b94246761816e2637fc8afd454d2b158213f7 (diff)
downloadlinux-2674700c4c0ec3bdeb1cd0ff4bf51ede2bc51c16.tar.xz
gpio: max732x: use devm_gpiochip_add_data()
We can simplify the code a bit with a resource managed variant of gpiochip_add_data(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpio-max732x.c')
-rw-r--r--drivers/gpio/gpio-max732x.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 7fd1bdfe00e5..42c9b6ce4227 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -698,15 +698,13 @@ static int max732x_probe(struct i2c_client *client,
return ret;
}
- ret = gpiochip_add_data(&chip->gpio_chip, chip);
+ ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
if (ret)
return ret;
ret = max732x_irq_setup(chip, id);
- if (ret) {
- gpiochip_remove(&chip->gpio_chip);
+ if (ret)
return ret;
- }
if (pdata && pdata->setup) {
ret = pdata->setup(client, chip->gpio_chip.base,
@@ -736,8 +734,6 @@ static int max732x_remove(struct i2c_client *client)
}
}
- gpiochip_remove(&chip->gpio_chip);
-
return 0;
}