Skip to contentSkip to conversation

usb: omap_udc: check return value of proc_create()

PATCH Superseded Kulikov Vasiliy 5 participants 5 messages Jul 31, 2010 – Aug 1, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/7 usb: omap_udc: check return value of proc_create()

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

---
 drivers/usb/gadget/omap_udc.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
drivers/usb/gadget/omap_udc.c +11 -5
index f81e4f0..1083216 100644
@@ -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
 
Signature · 1 line
1.7.0.4
#1 lore raw

Hello.

Quoted 3 lines · Kulikov Vasiliy

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

[...]

drivers/usb/gadget/omap_udc.c static const struct file_operations proc_ops = { · line 2549

Quoted 13 lines
drivers/usb/gadget/omap_udc.c +2 -2
index f81e4f0..1083216 100644
@@ -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);

Parens not needed around the *return* expression.

WBR, Sergei

#2 lore raw

Remove me!!!!

Please, remove my address [email protected] 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: [email protected] [mailto:[email protected]] On Behalf Of Sergei Shtylyov
Sent: Sunday, August 01, 2010 1:07 PM
To: Kulikov Vasiliy
Cc: [email protected]; David Brownell; Greg Kroah-Hartman; Tony Lindgren; Cory Maccarrone; [email protected]; [email protected]
Subject: Re: [PATCH 5/7] usb: omap_udc: check return value of proc_create()

Hello.

Quoted 3 lines · Kulikov Vasiliy

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

[...]

drivers/usb/gadget/omap_udc.c static const struct file_operations proc_ops = { · line 2549

Quoted 13 lines
drivers/usb/gadget/omap_udc.c +2 -2
index f81e4f0..1083216 100644
@@ -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);

Parens not needed around the *return* expression.

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

__________ 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

#4 lore raw

Re: Remove me!!!!

In reply to Yehuda Mor
Quoted 7 lines · Yehuda Mor

Please, remove my address [email protected] 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.

Hello,
Here is what you need to do:
To unsubscribe from this list [[email protected]]: send the line "unsubscribe linux-kernel" in the body of a message to:
[email protected]

And similarly, to unsubscribe from e.g [email protected] you should send e-mail to: [email protected] with "unsubscribe linux-usb" in the body.

Needless to say, you should send the e-mail(s) from the mailbox you receive unwanted mails on.

----------------------------
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Regards
trapDoor