Re: Remove me!!!!

Previous thread: [PATCH 4/7] usb: lh7a40x_udc: check return value of create_proc_read_entry() by Kulikov Vasiliy on Saturday, July 31, 2010 - 10:39 am. (1 message)

Next thread: Get Back To Me Immediately.... by Simon Dornooo on Saturday, July 31, 2010 - 10:37 am. (1 message)
From: Kulikov Vasiliy
Date: Saturday, July 31, 2010 - 10:39 am

proc_create() may fail, if so return -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/usb/gadget/omap_udc.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index f81e4f0..1083216 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2544,9 +2544,9 @@ static const struct file_operations proc_ops = {
 	.release	= single_release,
 };
 
-static void create_proc_file(void)
+static int create_proc_file(void)
 {
-	proc_create(proc_filename, 0, NULL, &proc_ops);
+	return (proc_create(proc_filename, 0, NULL, &proc_ops) == NULL);
 }
 
 static void remove_proc_file(void)
@@ -2556,7 +2556,7 @@ static void remove_proc_file(void)
 
 #else
 
-static inline void create_proc_file(void) {}
+static inline int create_proc_file(void) { return 0; }
 static inline void remove_proc_file(void) {}
 
 #endif
@@ -2998,13 +2998,19 @@ known:
 #endif
 	}
 
-	create_proc_file();
+	if (create_proc_file()) {
+		status = -ENOMEM;
+		goto cleanup3;
+	}
+
 	status = device_add(&udc->gadget.dev);
 	if (!status)
 		return status;
 	/* If fail, fall through */
-#ifdef	USE_ISO
+
+	remove_proc_file();
 cleanup3:
+#ifdef	USE_ISO
 	free_irq(pdev->resource[2].start, udc);
 #endif
 
-- 
1.7.0.4

--

From: Sergei Shtylyov
Date: Sunday, August 1, 2010 - 3:06 am

Hello.


    Parens not needed around the *return* expression.

WBR, Sergei
--

From: Yehuda Mor
Subject: Remove me!!!!
Date: Sunday, August 1, 2010 - 4:29 am

Please, remove my address praxis@actcom.co.il from your lists! I am
receiving unwanted mail from a lot of people around kernel, ubuntu' debian,
etc - and I have no idea why!

Thank you.  







-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Sergei Shtylyov
Sent: Sunday, August 01, 2010 1:07 PM
To: Kulikov Vasiliy
Cc: kernel-janitors@vger.kernel.org; David Brownell; Greg Kroah-Hartman;
Tony Lindgren; Cory Maccarrone; linux-usb@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/7] usb: omap_udc: check return value of proc_create()

Hello.


    Parens not needed around the *return* expression.

WBR, Sergei
--


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5329 (20100731) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5329 (20100731) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

--

From: Valeo de Vries
Date: Sunday, August 1, 2010 - 5:46 am

No need to spam all those people with this...


...as all you need to do is read the above, which is at the bottom of
every e-mail you receive from LKML.

Valeo
--

From: trapDoor
Date: Sunday, August 1, 2010 - 8:16 am

Hello,
Here is what you need to do:



-- 
Regards
trapDoor
--

Previous thread: [PATCH 4/7] usb: lh7a40x_udc: check return value of create_proc_read_entry() by Kulikov Vasiliy on Saturday, July 31, 2010 - 10:39 am. (1 message)

Next thread: Get Back To Me Immediately.... by Simon Dornooo on Saturday, July 31, 2010 - 10:37 am. (1 message)