lkml.org 
[lkml]   [2022]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH -next] [ARM] am300epd: Release platform device in case of platform_device_add_data() fails
From
kindly ping

在 2022/9/14 11:34, Lin Yujun 写道:
> The platform device need to be released when platform_device_add_data()
> fails. Use platform_device_put() to release 'pdev' in error path.
>
> Fixes: 4ce255c1420d ("[ARM] 5354/1: mach-pxa: add AM300 platform driver v3")
> Signed-off-by: Lin Yujun <linyujun809@huawei.com>
> ---
> arch/arm/mach-pxa/am300epd.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
> index 4b55bc89db8f..f8542b6aa9b7 100644
> --- a/arch/arm/mach-pxa/am300epd.c
> +++ b/arch/arm/mach-pxa/am300epd.c
> @@ -275,11 +275,14 @@ int __init am300_init(void)
> return -ENOMEM;
>
> /* the am300_board that will be seen by broadsheetfb is a copy */
> - platform_device_add_data(am300_device, &am300_board,
> + ret = platform_device_add_data(am300_device, &am300_board,
> sizeof(am300_board));
> + if (ret) {
> + platform_device_put(am300_device);
> + return ret;
> + }
>
> ret = platform_device_add(am300_device);
> -
> if (ret) {
> platform_device_put(am300_device);
> return ret;

\
 
 \ /
  Last update: 2022-09-26 11:19    [W:0.039 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site