Cypress: Adjustments for cypress_load_firmware()
Subsystems (3)
cover Cypress: Adjustments for cypress_load_firmware()
From: Markus Elfring <[email protected]>
Date: Mon, 28 Aug 2017 12:00:21 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation Improve a size determination
drivers/media/common/cypress_firmware.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/2 Cypress: Delete an error message for a failed memory allocation in cypress_load_firmware()
From: Markus Elfring <[email protected]>
Date: Mon, 28 Aug 2017 11:46:57 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/media/common/cypress_firmware.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/common/cypress_firmware.c +1 -3
@@ -78,7 +78,5 @@ int cypress_load_firmware(struct usb_device *udev, -if (!hx) { -dev_err (&udev->dev,"%s: kmalloc() failed\n" ,KBUILD_MODNAME ); +if (!hx)return -ENOMEM ; - }/* stop the CPU */ hx->data[0 ] =1 ;
Signature · 1 line
2.14.1
PATCH 2/2 Cypress: Improve a size determination in cypress_load_firmware()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Mon, 28 Aug 2017 11:55:16 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
--- drivers/media/common/cypress_firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/common/cypress_firmware.c +1 -1
@@ -74,7 +74,7 @@ int cypress_load_firmware(struct usb_device *udev,struct hexline *hx;int ret, pos =0 ; - hx =kmalloc (sizeof (struct hexline ),GFP_KERNEL ); + hx =kmalloc (sizeof (*hx),GFP_KERNEL );if (!hx)return -ENOMEM ;
Signature · 1 line
2.14.1