All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [media] imon: Adjustments for two function implementations
@ 2017-08-29 11:03 ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-08-29 11:03 UTC (permalink / raw)
  To: linux-media, Andi Shyti, Arnd Bergmann, Geliang Tang,
	Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus, Sean Young,
	Wolfram Sang
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 12:56:54 +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 in imon_init_intf0()
  Improve a size determination in two functions

 drivers/media/rc/imon.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.14.1

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

* [PATCH 0/2] [media] imon: Adjustments for two function implementations
@ 2017-08-29 11:03 ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-08-29 11:03 UTC (permalink / raw)
  To: linux-media, Andi Shyti, Arnd Bergmann, Geliang Tang,
	Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus, Sean Young,
	Wolfram Sang
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 12:56:54 +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 in imon_init_intf0()
  Improve a size determination in two functions

 drivers/media/rc/imon.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.14.1


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

* [PATCH 1/2] [media] imon: Delete an error message for a failed memory allocation in imon_init_intf0()
  2017-08-29 11:03 ` SF Markus Elfring
@ 2017-08-29 11:04   ` SF Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-08-29 11:04 UTC (permalink / raw)
  To: linux-media, Andi Shyti, Arnd Bergmann, Geliang Tang,
	Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus, Sean Young,
	Wolfram Sang
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 12:40:07 +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/rc/imon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index bd76534a2749..e6978f1b7f2c 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2313,7 +2313,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf,
-	if (!ictx) {
-		dev_err(dev, "%s: kzalloc failed for context", __func__);
+	if (!ictx)
 		goto exit;
-	}
+
 	rx_urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!rx_urb)
 		goto rx_urb_alloc_failed;
-- 
2.14.1

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

* [PATCH 1/2] [media] imon: Delete an error message for a failed memory allocation in imon_init_intf0(
@ 2017-08-29 11:04   ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-08-29 11:04 UTC (permalink / raw)
  To: linux-media, Andi Shyti, Arnd Bergmann, Geliang Tang,
	Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus, Sean Young,
	Wolfram Sang
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 12:40:07 +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/rc/imon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index bd76534a2749..e6978f1b7f2c 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2313,7 +2313,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf,
-	if (!ictx) {
-		dev_err(dev, "%s: kzalloc failed for context", __func__);
+	if (!ictx)
 		goto exit;
-	}
+
 	rx_urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!rx_urb)
 		goto rx_urb_alloc_failed;
-- 
2.14.1


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

* [PATCH 2/2] [media] imon: Improve a size determination in two functions
  2017-08-29 11:03 ` SF Markus Elfring
@ 2017-08-29 11:05   ` SF Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-08-29 11:05 UTC (permalink / raw)
  To: linux-media, Andi Shyti, Arnd Bergmann, Geliang Tang,
	Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus, Sean Young,
	Wolfram Sang
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 12:45:59 +0200

Replace the specification of data structures by pointer dereferences
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/rc/imon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index e6978f1b7f2c..27aab02b75b5 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -602,8 +602,7 @@ static int send_packet(struct imon_context *ictx)
 		ictx->tx_urb->actual_length = 0;
 	} else {
 		/* fill request into kmalloc'ed space: */
-		control_req = kmalloc(sizeof(struct usb_ctrlrequest),
-				      GFP_KERNEL);
+		control_req = kmalloc(sizeof(*control_req), GFP_KERNEL);
 		if (control_req == NULL)
 			return -ENOMEM;
 
@@ -2309,7 +2308,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf,
 	struct usb_host_interface *iface_desc;
 	int ret = -ENOMEM;
 
-	ictx = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
+	ictx = kzalloc(sizeof(*ictx), GFP_KERNEL);
 	if (!ictx)
 		goto exit;
 
-- 
2.14.1

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

* [PATCH 2/2] [media] imon: Improve a size determination in two functions
@ 2017-08-29 11:05   ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-08-29 11:05 UTC (permalink / raw)
  To: linux-media, Andi Shyti, Arnd Bergmann, Geliang Tang,
	Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus, Sean Young,
	Wolfram Sang
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 29 Aug 2017 12:45:59 +0200

Replace the specification of data structures by pointer dereferences
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/rc/imon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index e6978f1b7f2c..27aab02b75b5 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -602,8 +602,7 @@ static int send_packet(struct imon_context *ictx)
 		ictx->tx_urb->actual_length = 0;
 	} else {
 		/* fill request into kmalloc'ed space: */
-		control_req = kmalloc(sizeof(struct usb_ctrlrequest),
-				      GFP_KERNEL);
+		control_req = kmalloc(sizeof(*control_req), GFP_KERNEL);
 		if (control_req = NULL)
 			return -ENOMEM;
 
@@ -2309,7 +2308,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf,
 	struct usb_host_interface *iface_desc;
 	int ret = -ENOMEM;
 
-	ictx = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
+	ictx = kzalloc(sizeof(*ictx), GFP_KERNEL);
 	if (!ictx)
 		goto exit;
 
-- 
2.14.1


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

end of thread, other threads:[~2017-08-29 11:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 11:03 [PATCH 0/2] [media] imon: Adjustments for two function implementations SF Markus Elfring
2017-08-29 11:03 ` SF Markus Elfring
2017-08-29 11:04 ` [PATCH 1/2] [media] imon: Delete an error message for a failed memory allocation in imon_init_intf0() SF Markus Elfring
2017-08-29 11:04   ` [PATCH 1/2] [media] imon: Delete an error message for a failed memory allocation in imon_init_intf0( SF Markus Elfring
2017-08-29 11:05 ` [PATCH 2/2] [media] imon: Improve a size determination in two functions SF Markus Elfring
2017-08-29 11:05   ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.