linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] [media] MA901: Adjustments for usb_ma901radio_probe()
@ 2017-09-15 20:40 SF Markus Elfring
  2017-09-15 20:41 ` [PATCH 1/2] [media] ma901: Delete two error messages for a failed memory allocation in usb_ma901radio_probe() SF Markus Elfring
  2017-09-15 20:42 ` [PATCH 2/2] [media] ma901: Improve a size determination " SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-09-15 20:40 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 22:31:23 +0200

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

Markus Elfring (2):
  Delete two error messages for a failed memory allocation
  Improve a size determination

 drivers/media/radio/radio-ma901.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

-- 
2.14.1

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

* [PATCH 1/2] [media] ma901: Delete two error messages for a failed memory allocation in usb_ma901radio_probe()
  2017-09-15 20:40 [PATCH 0/2] [media] MA901: Adjustments for usb_ma901radio_probe() SF Markus Elfring
@ 2017-09-15 20:41 ` SF Markus Elfring
  2017-09-15 20:42 ` [PATCH 2/2] [media] ma901: Improve a size determination " SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-09-15 20:41 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 22:20:04 +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-ma901.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c
index fdc481257efd..c386fbd63703 100644
--- a/drivers/media/radio/radio-ma901.c
+++ b/drivers/media/radio/radio-ma901.c
@@ -361,10 +361,8 @@ static int usb_ma901radio_probe(struct usb_interface *intf,
 	if (!radio) {
-		dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");
 		retval = -ENOMEM;
 		goto err;
 	}
 
 	radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL);
 	if (!radio->buffer) {
-		dev_err(&intf->dev, "kmalloc for radio->buffer failed\n");
 		retval = -ENOMEM;
-- 
2.14.1

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

* [PATCH 2/2] [media] ma901: Improve a size determination in usb_ma901radio_probe()
  2017-09-15 20:40 [PATCH 0/2] [media] MA901: Adjustments for usb_ma901radio_probe() SF Markus Elfring
  2017-09-15 20:41 ` [PATCH 1/2] [media] ma901: Delete two error messages for a failed memory allocation in usb_ma901radio_probe() SF Markus Elfring
@ 2017-09-15 20:42 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-09-15 20:42 UTC (permalink / raw)
  To: linux-media, Alexey Klimov, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 22:23:42 +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-ma901.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c
index c386fbd63703..61d1657f1ee7 100644
--- a/drivers/media/radio/radio-ma901.c
+++ b/drivers/media/radio/radio-ma901.c
@@ -357,5 +357,5 @@ static int usb_ma901radio_probe(struct usb_interface *intf,
 		|| strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0))
 		return -ENODEV;
 
-	radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL);
+	radio = kzalloc(sizeof(*radio), GFP_KERNEL);
 	if (!radio) {
-- 
2.14.1

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

end of thread, other threads:[~2017-09-15 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-15 20:40 [PATCH 0/2] [media] MA901: Adjustments for usb_ma901radio_probe() SF Markus Elfring
2017-09-15 20:41 ` [PATCH 1/2] [media] ma901: Delete two error messages for a failed memory allocation in usb_ma901radio_probe() SF Markus Elfring
2017-09-15 20:42 ` [PATCH 2/2] [media] ma901: Improve a size determination " 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;
as well as URLs for NNTP newsgroup(s).