mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] [media] MR800: Adjustments for usb_amradio_probe()
@ 2017-09-16 10:50 SF Markus Elfring
  2017-09-16 10:51 ` [PATCH 1/3] [media] mr800: Delete two error messages for a failed memory allocation in usb_amradio_probe() SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 10:50 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 16 Sep 2017 12:35:43 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete two error messages for a failed memory allocation
  Improve a size determination
  Delete an unnecessary variable initialisation

 drivers/media/radio/radio-mr800.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

-- 
2.14.1

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

* [PATCH 1/3] [media] mr800: Delete two error messages for a failed memory allocation in usb_amradio_probe()
  2017-09-16 10:50 [PATCH 0/3] [media] MR800: Adjustments for usb_amradio_probe() SF Markus Elfring
@ 2017-09-16 10:51 ` SF Markus Elfring
  2017-09-16 10:52 ` [PATCH 2/3] [media] mr800: Improve a size determination " SF Markus Elfring
  2017-09-16 10:53 ` [PATCH 3/3] [media] mr800: Delete an unnecessary variable initialisation " SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 10:51 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 16 Sep 2017 11:23:53 +0200

Omit extra messages 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/radio-mr800.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index c9f59129af79..63a9b92ab495 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -518,5 +518,4 @@ static int usb_amradio_probe(struct usb_interface *intf,
 	if (!radio) {
-		dev_err(&intf->dev, "kmalloc for amradio_device failed\n");
 		retval = -ENOMEM;
 		goto err;
 	}
@@ -526,5 +525,4 @@ static int usb_amradio_probe(struct usb_interface *intf,
 	if (!radio->buffer) {
-		dev_err(&intf->dev, "kmalloc for radio->buffer failed\n");
 		retval = -ENOMEM;
 		goto err_nobuf;
 	}
-- 
2.14.1

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

* [PATCH 2/3] [media] mr800: Improve a size determination in usb_amradio_probe()
  2017-09-16 10:50 [PATCH 0/3] [media] MR800: Adjustments for usb_amradio_probe() SF Markus Elfring
  2017-09-16 10:51 ` [PATCH 1/3] [media] mr800: Delete two error messages for a failed memory allocation in usb_amradio_probe() SF Markus Elfring
@ 2017-09-16 10:52 ` SF Markus Elfring
  2017-09-16 10:53 ` [PATCH 3/3] [media] mr800: Delete an unnecessary variable initialisation " SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 10:52 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 16 Sep 2017 11:34:11 +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/radio-mr800.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 63a9b92ab495..7c4554ce1cf0 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -515,4 +515,3 @@ static int usb_amradio_probe(struct usb_interface *intf,
 
-	radio = kzalloc(sizeof(struct amradio_device), GFP_KERNEL);
-
+	radio = kzalloc(sizeof(*radio), GFP_KERNEL);
 	if (!radio) {
-- 
2.14.1

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

* [PATCH 3/3] [media] mr800: Delete an unnecessary variable initialisation in usb_amradio_probe()
  2017-09-16 10:50 [PATCH 0/3] [media] MR800: Adjustments for usb_amradio_probe() SF Markus Elfring
  2017-09-16 10:51 ` [PATCH 1/3] [media] mr800: Delete two error messages for a failed memory allocation in usb_amradio_probe() SF Markus Elfring
  2017-09-16 10:52 ` [PATCH 2/3] [media] mr800: Improve a size determination " SF Markus Elfring
@ 2017-09-16 10:53 ` SF Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-16 10:53 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 16 Sep 2017 11:39:50 +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/radio-mr800.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 7c4554ce1cf0..a1f4dc9be284 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -511,5 +511,5 @@ static int usb_amradio_probe(struct usb_interface *intf,
 				const struct usb_device_id *id)
 {
 	struct amradio_device *radio;
-	int retval = 0;
+	int retval;
 
-- 
2.14.1

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-16 10:50 [PATCH 0/3] [media] MR800: Adjustments for usb_amradio_probe() SF Markus Elfring
2017-09-16 10:51 ` [PATCH 1/3] [media] mr800: Delete two error messages for a failed memory allocation in usb_amradio_probe() SF Markus Elfring
2017-09-16 10:52 ` [PATCH 2/3] [media] mr800: Improve a size determination " SF Markus Elfring
2017-09-16 10:53 ` [PATCH 3/3] [media] mr800: 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