USB: emi26: Delete an error message for a failed memory allocation in emi26_writememory()
Subsystems (2)
PATCH 1/1 USB: emi26: Delete an error message for a failed memory allocation in emi26_writememory()
From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 13:03:21 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/usb/misc/emi26.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/misc/emi26.c +2 -3
@@ -42,10 +42,9 @@ static int emi26_writememory (struct usb_device *dev, int address,int result;unsigned char *buffer =kmemdup (data, length,GFP_KERNEL ); -if (!buffer) { -dev_err (&dev->dev,"kmalloc(%d) failed.\n" , length); +if (!buffer)return -ENOMEM ; - } +/* Note: usb_control_msg returns negative value on error or length of the * data that was written! */ result =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), request,0x40 , address,0 , buffer, length,300 );
Signature · 1 line
2.15.1
Quoted 17 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 13:03:21 +0100Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/usb/misc/emi26.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/usb/misc/emi26.c +0
-0
drivers/usb/misc/emi26.c static int emi26_writememory (struct usb_device *dev, int address, · line 46
Quoted 5 lines
drivers/usb/misc/emi26.c +0
-2@@ -42,10 +42,9 @@ static int emi26_writememory (struct usb_device *dev, int address,int result;unsigned char *buffer =kmemdup (data, length,GFP_KERNEL ); -if (!buffer) { -dev_err (&dev->dev,"kmalloc(%d) failed.\n" , length);
I guess the length information would not be so easy to find in the backtrace.
julia
Quoted 15 lines
drivers/usb/misc/emi26.c +2
-2+if (!buffer)return -ENOMEM ; - } +/* Note: usb_control_msg returns negative value on error or length of the * data that was written! */ result =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), request,0x40 , address,0 , buffer, length,300 ); --2.15.1
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Julia Lawall
Quoted 20 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 6 Dec 2017 13:03:21 +0100Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/usb/misc/emi26.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/usb/misc/emi26.c +0
-0@@ -42,10 +42,9 @@ static int emi26_writememory (struct usb_device *dev, int address,int result;unsigned char *buffer =kmemdup (data, length,GFP_KERNEL );
Quoted 6 lines
drivers/usb/misc/emi26.c static int emi26_writememory (struct usb_device *dev, int address, · line 46
Quoted 2 lines
drivers/usb/misc/emi26.c +0
-2-if (!buffer) { -dev_err (&dev->dev,"kmalloc(%d) failed.\n" , length);I guess the length information would not be so easy to find in the backtrace.
I think it prints the "order" but not the exact size.
regards,
dan carpeneter
Quoted 8 lines
drivers/usb/misc/emi26.c static int emi26_writememory (struct usb_device *dev, int address, · line 46
Quoted 6 lines
drivers/usb/misc/emi26.c +0
-2@@ -42,10 +42,9 @@ static int emi26_writememory (struct usb_device *dev, int address,int result;unsigned char *buffer =kmemdup (data, length,GFP_KERNEL ); -if (!buffer) { -dev_err (&dev->dev,"kmalloc(%d) failed.\n" , length);I guess the length information would not be so easy to find in the backtrace.
Why do you “guess”?
Quoted 3 lines
drivers/usb/misc/emi26.c static int emi26_writememory (struct usb_device *dev, int address, · line 48
Quoted 3 lines
drivers/usb/misc/emi26.c +1
-1+if (!buffer)return -ENOMEM ; - }
Would we like to achieve another consensus on the data which are provided by a default Linux allocation failure report?
Regards,
Markus