gpio: xgene: simplify probe, return devm_gpiochip_add_data() directly
authorAlexandru Ardelean <aardelean@deviqon.com>
Fri, 21 May 2021 18:10:42 +0000 (21:10 +0300)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Sun, 23 May 2021 18:30:26 +0000 (20:30 +0200)
The handling of the return value from devm_gpiochip_add_data() is a bit
redundant. It prints messages on error and success cases.
While the success message may be useful, it is more in the area of log
spam, and these can be printed with other forms of kernel logging.

This change does a direct return with devm_gpiochip_add_data() in the probe
function.

The platform_set_drvdata() is needed, as this driver uses the stored
private date in the PM suspend/resume routines.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-xgene.c

index 532b0df8a1f27fe72d179823b94b84e9d6201838..fb4b0c67aeef46a3810178a3a1b6870d04c8ecdf 100644 (file)
@@ -159,7 +159,6 @@ static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
 static int xgene_gpio_probe(struct platform_device *pdev)
 {
        struct xgene_gpio *gpio;
-       int err = 0;
 
        gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
        if (!gpio)
@@ -183,15 +182,7 @@ static int xgene_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, gpio);
 
-       err = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
-       if (err) {
-               dev_err(&pdev->dev,
-                       "failed to register gpiochip.\n");
-               return err;
-       }
-
-       dev_info(&pdev->dev, "X-Gene GPIO driver registered.\n");
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
 }
 
 static const struct of_device_id xgene_gpio_of_match[] = {