Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: wm8994: remove platform_set_drvdata() + cleanup probe

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.

If this is removed, we can also just do a direct return on
devm_gpiochip_add_data(). We don't need to print that this call failed as
there are other ways to log/see this during probe.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

authored by

Alexandru Ardelean and committed by
Bartosz Golaszewski
e076aeda 14ebdaec

+1 -12
+1 -12
drivers/gpio/gpio-wm8994.c
··· 263 263 struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent); 264 264 struct wm8994_pdata *pdata = dev_get_platdata(wm8994->dev); 265 265 struct wm8994_gpio *wm8994_gpio; 266 - int ret; 267 266 268 267 wm8994_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8994_gpio), 269 268 GFP_KERNEL); ··· 278 279 else 279 280 wm8994_gpio->gpio_chip.base = -1; 280 281 281 - ret = devm_gpiochip_add_data(&pdev->dev, &wm8994_gpio->gpio_chip, 282 - wm8994_gpio); 283 - if (ret < 0) { 284 - dev_err(&pdev->dev, "Could not register gpiochip, %d\n", 285 - ret); 286 - return ret; 287 - } 288 - 289 - platform_set_drvdata(pdev, wm8994_gpio); 290 - 291 - return ret; 282 + return devm_gpiochip_add_data(&pdev->dev, &wm8994_gpio->gpio_chip, wm8994_gpio); 292 283 } 293 284 294 285 static struct platform_driver wm8994_gpio_driver = {