lkml.org 
[lkml]   [2016]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RESEND RFC PATCH 1/5] platform: x86: add driver for UP Board I/O CPLD
From
Date
On Mon, 2016-07-04 at 17:07 +0100, Dan O'Donovan wrote:
> + cpld->pinctrl_pdev =
> + platform_device_register_data(dev, "up-board-
> pinctrl",
> +       PLATFORM_DEVID_NONE,
> +       &up_board_pinctrl_pdat
> a,
> +       sizeof(up_board_pinctr
> l_pdata));
> + if (IS_ERR(cpld->pinctrl_pdev)) {
> + ret = PTR_ERR(cpld->pinctrl_pdev);
> + goto fail_register_pinctrl_pdev;
> + }
> +
> + cpld->gpio_pdev =
> + platform_device_register_data(dev, "up-board-gpio",
> +       PLATFORM_DEVID_NONE,
> +       &up_board_gpio_pdata,
> +       sizeof(up_board_gpio_p
> data));
> + if (IS_ERR(cpld->gpio_pdev)) {
> + ret = PTR_ERR(cpld->gpio_pdev);
> + goto fail_register_gpio_pdev;
> + }
> +
> + cpld->leds_pdev =
> + platform_device_register_data(dev, "up-board-leds",
> +       PLATFORM_DEVID_NONE,
> +       &up_board_leds_pdata,
> +       sizeof(up_board_leds_p
> data));
> + if (IS_ERR(cpld->leds_pdev)) {
> + ret = PTR_ERR(cpld->leds_pdev);
> + goto fail_register_leds_pdev;
> + }
> +
> + return 0;
> +
> +fail_register_leds_pdev:
> + platform_device_unregister(cpld->gpio_pdev);
> +fail_register_gpio_pdev:
> + platform_device_unregister(cpld->pinctrl_pdev);
> +fail_register_pinctrl_pdev:

Because the subordinate drivers don't have remove routines if any of
these error paths are triggered you'll leak resources. Recommend adding
cleanup exit routines to the subordinate drivers which should then be
triggered on the failure jumps here.

---
bod

\
 
 \ /
  Last update: 2016-07-08 19:41    [W:0.097 / U:10.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site