summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-adp5520.c
diff options
context:
space:
mode:
authorAlexandru Ardelean <aardelean@deviqon.com>2021-05-14 11:56:27 +0300
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2021-05-21 16:29:53 +0300
commit6681db5ef540bc47a654c8d85d27042626edc6f8 (patch)
tree235d746c1e23e55e16d28c1fb6222462930a0b22 /drivers/gpio/gpio-adp5520.c
parentec5aa31bbed6ca153b47f60af0d21032296b04ad (diff)
downloadlinux-6681db5ef540bc47a654c8d85d27042626edc6f8.tar.xz
gpio: adp5520: cleanup probe error path + remove platform_set_drvdata()
The platform_set_drvdata() call is only useful if we need to retrieve back the private information. Since the driver doesn't do that, it's not useful to have it. This also means that the 'err' label can be removed and all goto statements replaced with direct returns (with error codes). Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpio-adp5520.c')
-rw-r--r--drivers/gpio/gpio-adp5520.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index 0386ede53f3a..c55e821c63b6 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -113,10 +113,8 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
if (pdata->gpio_en_mask & (1 << i))
dev->lut[gpios++] = 1 << i;
- if (gpios < 1) {
- ret = -EINVAL;
- goto err;
- }
+ if (gpios < 1)
+ return -EINVAL;
gc = &dev->gpio_chip;
gc->direction_input = adp5520_gpio_direction_input;
@@ -148,18 +146,10 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "failed to write\n");
- goto err;
+ return ret;
}
- ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
- if (ret)
- goto err;
-
- platform_set_drvdata(pdev, dev);
- return 0;
-
-err:
- return ret;
+ return devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
}
static struct platform_driver adp5520_gpio_driver = {