si470x: Adjustments for si470x_usb_driver_probe()
cover si470x: Adjustments for si470x_usb_driver_probe()
From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 15:16:17 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation Improve a size determination
Delete an unnecessary variable initialisation
drivers/media/radio/si470x/radio-si470x-usb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/3 si470x: Delete an error message for a failed memory allocation in si470x_usb_driver_probe()
From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 14:53:49 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/media/radio/si470x/radio-si470x-usb.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/radio/si470x/radio-si470x-usb.c +0 -1
@@ -618,5 +618,4 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,if (!radio->int_in_buffer) { -dev_info (&intf->dev,"could not allocate int_in_buffer" ); retval = -ENOMEM ; goto err_usbbuf; }
Signature · 1 line
2.14.1
PATCH 2/3 si470x: Improve a size determination in si470x_usb_driver_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 14:58:06 +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/radio/si470x/radio-si470x-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/si470x/radio-si470x-usb.c +1 -1
@@ -584,5 +584,5 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,/* private data allocation and initialization */ - radio =kzalloc (sizeof (struct si470x_device ),GFP_KERNEL ); + radio =kzalloc (sizeof (*radio),GFP_KERNEL );if (!radio) { retval = -ENOMEM ; goto err_initial;
Signature · 1 line
2.14.1
PATCH 3/3 si470x: Delete an unnecessary variable initialisation in si470x_usb_driver_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 15:08:39 +0200
The variable "retval" will eventually be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/radio/si470x/radio-si470x-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/si470x/radio-si470x-usb.c +1 -1
@@ -578,6 +578,6 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,struct si470x_device *radio;struct usb_host_interface *iface_desc;struct usb_endpoint_descriptor *endpoint; -int i, int_end_size, retval =0 ; +int i, int_end_size, retval;unsigned char version_warning =0 ;
Signature · 1 line
2.14.1