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

gpio: ts5500: Use devm_gpiochip_add_data() for gpio registration

Use devm_gpiochip_add_data() for GPIO registration and clean the
error path.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>

+3 -6
+3 -6
drivers/gpio/gpio-ts5500.c
··· 409 409 break; 410 410 } 411 411 412 - ret = gpiochip_add_data(&priv->gpio_chip, priv); 412 + ret = devm_gpiochip_add_data(dev, &priv->gpio_chip, priv); 413 413 if (ret) { 414 414 dev_err(dev, "failed to register the gpio chip\n"); 415 415 return ret; ··· 418 418 ret = ts5500_enable_irq(priv); 419 419 if (ret) { 420 420 dev_err(dev, "invalid interrupt %d\n", priv->hwirq); 421 - goto cleanup; 421 + return ret; 422 422 } 423 423 424 424 return 0; 425 - cleanup: 426 - gpiochip_remove(&priv->gpio_chip); 427 - return ret; 428 425 } 429 426 430 427 static int ts5500_dio_remove(struct platform_device *pdev) ··· 429 432 struct ts5500_priv *priv = platform_get_drvdata(pdev); 430 433 431 434 ts5500_disable_irq(priv); 432 - gpiochip_remove(&priv->gpio_chip); 435 + 433 436 return 0; 434 437 } 435 438