linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev: n411: check return value
@ 2016-02-23 12:56 Sudip Mukherjee
  2016-02-26 10:18 ` Tomi Valkeinen
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-02-23 12:56 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen
  Cc: linux-kernel, linux-fbdev, Sudip Mukherjee

We were not checking the return value of platform_device_add_data()
which can fail.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 drivers/video/fbdev/n411.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/n411.c b/drivers/video/fbdev/n411.c
index 935830f..053deac 100644
--- a/drivers/video/fbdev/n411.c
+++ b/drivers/video/fbdev/n411.c
@@ -165,16 +165,22 @@ static int __init n411_init(void)
 	if (!n411_device)
 		return -ENOMEM;
 
-	platform_device_add_data(n411_device, &n411_board, sizeof(n411_board));
+	ret = platform_device_add_data(n411_device, &n411_board,
+				       sizeof(n411_board));
+	if (ret)
+		goto put_plat_device;
 
 	/* this _add binds hecubafb to n411. hecubafb refcounts n411 */
 	ret = platform_device_add(n411_device);
 
 	if (ret)
-		platform_device_put(n411_device);
+		goto put_plat_device;
 
-	return ret;
+	return 0;
 
+put_plat_device:
+	platform_device_put(n411_device);
+	return ret;
 }
 
 static void __exit n411_exit(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fbdev: n411: check return value
  2016-02-23 12:56 [PATCH] fbdev: n411: check return value Sudip Mukherjee
@ 2016-02-26 10:18 ` Tomi Valkeinen
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2016-02-26 10:18 UTC (permalink / raw)
  To: Sudip Mukherjee, Jean-Christophe Plagniol-Villard
  Cc: linux-kernel, linux-fbdev


[-- Attachment #1.1: Type: text/plain, Size: 355 bytes --]



On 23/02/16 14:44, Sudip Mukherjee wrote:
> We were not checking the return value of platform_device_add_data()
> which can fail.
> 
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/video/fbdev/n411.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Thanks, queued for 4.6.

 Tomi


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-26 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 12:56 [PATCH] fbdev: n411: check return value Sudip Mukherjee
2016-02-26 10:18 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).