mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] [media] si470x: Adjustments for si470x_usb_driver_probe()
@ 2017-09-16 13:35 SF Markus Elfring
  2017-09-16 13:37 ` [PATCH 1/3] [media] si470x: Delete an error message for a failed memory allocation in si470x_usb_driver_probe() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 13:35 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] [media] si470x: Delete an error message for a failed memory allocation in si470x_usb_driver_probe()
  2017-09-16 13:35 [PATCH 0/3] [media] si470x: Adjustments for si470x_usb_driver_probe() SF Markus Elfring
@ 2017-09-16 13:37 ` SF Markus Elfring
  2017-09-16 13:38 ` [PATCH 2/3] [media] si470x: Improve a size determination " SF Markus Elfring
  2017-09-16 13:39 ` [PATCH 3/3] [media] si470x: Delete an unnecessary variable initialisation " SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 13:37 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/radio/si470x/radio-si470x-usb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index c311f9951d80..af295530b20f 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -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;
 	}
-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] [media] si470x: Improve a size determination in si470x_usb_driver_probe()
  2017-09-16 13:35 [PATCH 0/3] [media] si470x: Adjustments for si470x_usb_driver_probe() SF Markus Elfring
  2017-09-16 13:37 ` [PATCH 1/3] [media] si470x: Delete an error message for a failed memory allocation in si470x_usb_driver_probe() SF Markus Elfring
@ 2017-09-16 13:38 ` SF Markus Elfring
  2017-09-16 13:39 ` [PATCH 3/3] [media] si470x: Delete an unnecessary variable initialisation " SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 13:38 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index af295530b20f..6fc6e8235f20 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -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;
-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] [media] si470x: Delete an unnecessary variable initialisation in si470x_usb_driver_probe()
  2017-09-16 13:35 [PATCH 0/3] [media] si470x: Adjustments for si470x_usb_driver_probe() SF Markus Elfring
  2017-09-16 13:37 ` [PATCH 1/3] [media] si470x: Delete an error message for a failed memory allocation in si470x_usb_driver_probe() SF Markus Elfring
  2017-09-16 13:38 ` [PATCH 2/3] [media] si470x: Improve a size determination " SF Markus Elfring
@ 2017-09-16 13:39 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 13:39 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index 6fc6e8235f20..ae30e3da9d13 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -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;
 
-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-16 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-16 13:35 [PATCH 0/3] [media] si470x: Adjustments for si470x_usb_driver_probe() SF Markus Elfring
2017-09-16 13:37 ` [PATCH 1/3] [media] si470x: Delete an error message for a failed memory allocation in si470x_usb_driver_probe() SF Markus Elfring
2017-09-16 13:38 ` [PATCH 2/3] [media] si470x: Improve a size determination " SF Markus Elfring
2017-09-16 13:39 ` [PATCH 3/3] [media] si470x: Delete an unnecessary variable initialisation " SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome