linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] [media] Cypress: Adjustments for cypress_load_firmware()
@ 2017-08-28 10:08 SF Markus Elfring
  2017-08-28 10:09 ` [PATCH 1/2] [media] Cypress: Delete an error message for a failed memory allocation in cypress_load_firmware() SF Markus Elfring
  2017-08-28 10:12 ` [PATCH 2/2] [media] Cypress: Improve a size determination " SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-28 10:08 UTC (permalink / raw)
  To: linux-media, Antti Palosaari, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 28 Aug 2017 12:00:21 +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
  Improve a size determination

 drivers/media/common/cypress_firmware.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.14.1

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

* [PATCH 1/2] [media] Cypress: Delete an error message for a failed memory allocation in cypress_load_firmware()
  2017-08-28 10:08 [PATCH 0/2] [media] Cypress: Adjustments for cypress_load_firmware() SF Markus Elfring
@ 2017-08-28 10:09 ` SF Markus Elfring
  2017-08-28 10:12 ` [PATCH 2/2] [media] Cypress: Improve a size determination " SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-28 10:09 UTC (permalink / raw)
  To: linux-media, Antti Palosaari, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 28 Aug 2017 11:46:57 +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/common/cypress_firmware.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/common/cypress_firmware.c b/drivers/media/common/cypress_firmware.c
index 50e3f76d4847..bfe47bc5f716 100644
--- a/drivers/media/common/cypress_firmware.c
+++ b/drivers/media/common/cypress_firmware.c
@@ -78,7 +78,5 @@ int cypress_load_firmware(struct usb_device *udev,
-	if (!hx) {
-		dev_err(&udev->dev, "%s: kmalloc() failed\n", KBUILD_MODNAME);
+	if (!hx)
 		return -ENOMEM;
-	}
 
 	/* stop the CPU */
 	hx->data[0] = 1;
-- 
2.14.1

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

* [PATCH 2/2] [media] Cypress: Improve a size determination in cypress_load_firmware()
  2017-08-28 10:08 [PATCH 0/2] [media] Cypress: Adjustments for cypress_load_firmware() SF Markus Elfring
  2017-08-28 10:09 ` [PATCH 1/2] [media] Cypress: Delete an error message for a failed memory allocation in cypress_load_firmware() SF Markus Elfring
@ 2017-08-28 10:12 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-08-28 10:12 UTC (permalink / raw)
  To: linux-media, Antti Palosaari, Mauro Carvalho Chehab; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 28 Aug 2017 11:55:16 +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/common/cypress_firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/common/cypress_firmware.c b/drivers/media/common/cypress_firmware.c
index bfe47bc5f716..8895158c1962 100644
--- a/drivers/media/common/cypress_firmware.c
+++ b/drivers/media/common/cypress_firmware.c
@@ -74,7 +74,7 @@ int cypress_load_firmware(struct usb_device *udev,
 	struct hexline *hx;
 	int ret, pos = 0;
 
-	hx = kmalloc(sizeof(struct hexline), GFP_KERNEL);
+	hx = kmalloc(sizeof(*hx), GFP_KERNEL);
 	if (!hx)
 		return -ENOMEM;
 
-- 
2.14.1

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

end of thread, other threads:[~2017-08-28 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 10:08 [PATCH 0/2] [media] Cypress: Adjustments for cypress_load_firmware() SF Markus Elfring
2017-08-28 10:09 ` [PATCH 1/2] [media] Cypress: Delete an error message for a failed memory allocation in cypress_load_firmware() SF Markus Elfring
2017-08-28 10:12 ` [PATCH 2/2] [media] Cypress: 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).