diff mbox series

[-next] ARM: davinci: da850-evm: add missing platform_device_unregister in da850_lcd_hw_init

Message ID 20220511090456.3428850-1-zhengbin13@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] ARM: davinci: da850-evm: add missing platform_device_unregister in da850_lcd_hw_init | expand

Commit Message

Zheng Bin May 11, 2022, 9:04 a.m. UTC
da850_lcd_hw_init misses a call platform_device_unregister in error path,
this patch fixes that.

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 arch/arm/mach-davinci/board-da850-evm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.31.1

Comments

Bartosz Golaszewski May 14, 2022, 12:39 p.m. UTC | #1
On Wed, May 11, 2022 at 10:51 AM Zheng Bin <zhengbin13@huawei.com> wrote:
>
> da850_lcd_hw_init misses a call platform_device_unregister in error path,
> this patch fixes that.
>
> Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
> ---
>  arch/arm/mach-davinci/board-da850-evm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index efc26b472ef8..7b2a1a37e5c0 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -873,8 +873,10 @@ static int da850_lcd_hw_init(void)
>                 return PTR_ERR(backlight);
>
>         status = platform_device_register(&da850_lcd_supply_device);
> -       if (status)
> +       if (status) {
> +               platform_device_unregister(backlight);
>                 return status;
> +       }
>
>         return 0;
>  }
> --
> 2.31.1
>

Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
diff mbox series

Patch

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index efc26b472ef8..7b2a1a37e5c0 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -873,8 +873,10 @@  static int da850_lcd_hw_init(void)
 		return PTR_ERR(backlight);

 	status = platform_device_register(&da850_lcd_supply_device);
-	if (status)
+	if (status) {
+		platform_device_unregister(backlight);
 		return status;
+	}

 	return 0;
 }