am300epd: Release platform device in case of platform_device_add_data() fails
Subsystems (3)
PATCH 1/1 am300epd: Release platform device in case of platform_device_add_data() fails
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 <[email protected]>
--- arch/arm/mach-pxa/am300epd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/am300epd.c +5 -2
@@ -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;
Signature · 1 line
2.17.1
kindly ping
Quoted 20 lines · Lin Yujun
The platform device need to be released when
platform_device_add_data()fails. Useplatform_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 <[email protected]>--- arch/arm/mach-pxa/am300epd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)arch/arm/mach-pxa/am300epd.c +1
-1@@ -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));
arch/arm/mach-pxa/am300epd.c int __init am300_init(void) · line 288
Quoted 10 lines
arch/arm/mach-pxa/am300epd.c +4
-1+if (ret) { +platform_device_put (am300_device); +return ret; + } ret =platform_device_add (am300_device); -if (ret) {platform_device_put (am300_device);return ret;
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel