linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations
@ 2017-09-03 20:30 SF Markus Elfring
  2017-09-03 20:31 ` [PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc() SF Markus Elfring
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:30 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

>From 2f421e83375df1aeef50ce053f1dbcd1366c2365 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 20:50:10 +0200
Subject: [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations

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

Markus Elfring (7):
  Delete an error message for a failed memory allocation in saa7164_buffer_alloc()
  SAA7164: Improve a size determination in two functions
  Gemini: Delete an error message for a failed memory allocation in hexium_attach()
  Gemini: Improve a size determination in hexium_attach()
  Orion: Delete an error message for a failed memory allocation in hexium_probe()
  Orion: Improve a size determination in hexium_probe()
  Orion: Adjust one function call together with a variable assignment

 drivers/media/pci/saa7146/hexium_gemini.c  |  7 +++----
 drivers/media/pci/saa7146/hexium_orion.c   | 10 +++++-----
 drivers/media/pci/saa7164/saa7164-buffer.c |  8 +++-----
 3 files changed, 11 insertions(+), 14 deletions(-)

-- 
2.14.1

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

* [PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc()
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
@ 2017-09-03 20:31 ` SF Markus Elfring
  2017-09-03 20:32 ` [PATCH 2/7] [media] saa7164: Improve a size determination in two functions SF Markus Elfring
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:31 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 17:47:41 +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/pci/saa7164/saa7164-buffer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c
index a0d2129c6ca9..6bd665ea190d 100644
--- a/drivers/media/pci/saa7164/saa7164-buffer.c
+++ b/drivers/media/pci/saa7164/saa7164-buffer.c
@@ -102,7 +102,5 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
-	if (!buf) {
-		log_warn("%s() SAA_ERR_NO_RESOURCES\n", __func__);
+	if (!buf)
 		goto ret;
-	}
 
 	buf->idx = -1;
 	buf->port = port;
-- 
2.14.1

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

* [PATCH 2/7] [media] saa7164: Improve a size determination in two functions
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
  2017-09-03 20:31 ` [PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc() SF Markus Elfring
@ 2017-09-03 20:32 ` SF Markus Elfring
  2017-09-03 20:33 ` [PATCH 3/7] [media] Hexium Gemini: Delete an error message for a failed memory allocation in hexium_attach() SF Markus Elfring
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:32 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 17:53:05 +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/pci/saa7164/saa7164-buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c
index 6bd665ea190d..c83b2e914dcb 100644
--- a/drivers/media/pci/saa7164/saa7164-buffer.c
+++ b/drivers/media/pci/saa7164/saa7164-buffer.c
@@ -98,5 +98,5 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
 		goto ret;
 	}
 
-	buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL);
+	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 	if (!buf)
@@ -281,5 +281,5 @@ struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev,
 {
 	struct saa7164_user_buffer *buf;
 
-	buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL);
+	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 	if (!buf)
-- 
2.14.1

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

* [PATCH 3/7] [media] Hexium Gemini: Delete an error message for a failed memory allocation in hexium_attach()
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
  2017-09-03 20:31 ` [PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc() SF Markus Elfring
  2017-09-03 20:32 ` [PATCH 2/7] [media] saa7164: Improve a size determination in two functions SF Markus Elfring
@ 2017-09-03 20:33 ` SF Markus Elfring
  2017-09-03 20:34 ` [PATCH 4/7] [media] Hexium Gemini: Improve a size determination " SF Markus Elfring
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:33 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 19:23:37 +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/pci/saa7146/hexium_gemini.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c
index c889ec9f8a5a..694b70fa3baf 100644
--- a/drivers/media/pci/saa7146/hexium_gemini.c
+++ b/drivers/media/pci/saa7146/hexium_gemini.c
@@ -264,7 +264,6 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
-	if (NULL == hexium) {
-		pr_err("not enough kernel memory in hexium_attach()\n");
+	if (!hexium)
 		return -ENOMEM;
-	}
+
 	dev->ext_priv = hexium;
 
 	/* enable i2c-port pins */
-- 
2.14.1

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

* [PATCH 4/7] [media] Hexium Gemini: Improve a size determination in hexium_attach()
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-09-03 20:33 ` [PATCH 3/7] [media] Hexium Gemini: Delete an error message for a failed memory allocation in hexium_attach() SF Markus Elfring
@ 2017-09-03 20:34 ` SF Markus Elfring
  2017-09-03 20:35 ` [PATCH 5/7] [media] Hexium Orion: Delete an error message for a failed memory allocation in hexium_probe() SF Markus Elfring
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:34 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 19:51:46 +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/pci/saa7146/hexium_gemini.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c
index 694b70fa3baf..a0fcf8150291 100644
--- a/drivers/media/pci/saa7146/hexium_gemini.c
+++ b/drivers/media/pci/saa7146/hexium_gemini.c
@@ -260,5 +260,5 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
 
 	DEB_EE("\n");
 
-	hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
+	hexium = kzalloc(sizeof(*hexium), GFP_KERNEL);
 	if (!hexium)
-- 
2.14.1

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

* [PATCH 5/7] [media] Hexium Orion: Delete an error message for a failed memory allocation in hexium_probe()
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2017-09-03 20:34 ` [PATCH 4/7] [media] Hexium Gemini: Improve a size determination " SF Markus Elfring
@ 2017-09-03 20:35 ` SF Markus Elfring
  2017-09-03 20:36 ` [PATCH 6/7] [media] Hexium Orion: Improve a size determination " SF Markus Elfring
  2017-09-03 20:37 ` [PATCH 7/7] [media] Hexium Orion: Adjust one function call together with a variable assignment SF Markus Elfring
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:35 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 19:55:25 +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/pci/saa7146/hexium_orion.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c
index c306a92e8909..72fac6a8494a 100644
--- a/drivers/media/pci/saa7146/hexium_orion.c
+++ b/drivers/media/pci/saa7146/hexium_orion.c
@@ -223,7 +223,5 @@ static int hexium_probe(struct saa7146_dev *dev)
-	if (NULL == hexium) {
-		pr_err("hexium_probe: not enough kernel memory\n");
+	if (!hexium)
 		return -ENOMEM;
-	}
 
 	/* enable i2c-port pins */
 	saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
-- 
2.14.1

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

* [PATCH 6/7] [media] Hexium Orion: Improve a size determination in hexium_probe()
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
                   ` (4 preceding siblings ...)
  2017-09-03 20:35 ` [PATCH 5/7] [media] Hexium Orion: Delete an error message for a failed memory allocation in hexium_probe() SF Markus Elfring
@ 2017-09-03 20:36 ` SF Markus Elfring
  2017-09-03 20:37 ` [PATCH 7/7] [media] Hexium Orion: Adjust one function call together with a variable assignment SF Markus Elfring
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:36 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 20:00:17 +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/pci/saa7146/hexium_orion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c
index 72fac6a8494a..187e072a3697 100644
--- a/drivers/media/pci/saa7146/hexium_orion.c
+++ b/drivers/media/pci/saa7146/hexium_orion.c
@@ -219,5 +219,5 @@ static int hexium_probe(struct saa7146_dev *dev)
 		return -EFAULT;
 	}
 
-	hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
+	hexium = kzalloc(sizeof(*hexium), GFP_KERNEL);
 	if (!hexium)
-- 
2.14.1

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

* [PATCH 7/7] [media] Hexium Orion: Adjust one function call together with a variable assignment
  2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
                   ` (5 preceding siblings ...)
  2017-09-03 20:36 ` [PATCH 6/7] [media] Hexium Orion: Improve a size determination " SF Markus Elfring
@ 2017-09-03 20:37 ` SF Markus Elfring
  6 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-09-03 20:37 UTC (permalink / raw)
  To: linux-media, Hans Verkuil, Mauro Carvalho Chehab, Sakari Ailus
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 20:12:36 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/pci/saa7146/hexium_orion.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c
index 187e072a3697..691472763696 100644
--- a/drivers/media/pci/saa7146/hexium_orion.c
+++ b/drivers/media/pci/saa7146/hexium_orion.c
@@ -266,7 +266,9 @@ static int hexium_probe(struct saa7146_dev *dev)
 
 	/* check if this is an old hexium Orion card by looking at
 	   a saa7110 at address 0x4e */
-	if (0 == (err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, 0x00, I2C_SMBUS_BYTE_DATA, &data))) {
+	err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ,
+			     0x00, I2C_SMBUS_BYTE_DATA, &data);
+	if (err == 0) {
 		pr_info("device is a Hexium HV-PCI6/Orion (old)\n");
 		/* we store the pointer in our private data field */
 		dev->ext_priv = hexium;
-- 
2.14.1

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
2017-09-03 20:31 ` [PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc() SF Markus Elfring
2017-09-03 20:32 ` [PATCH 2/7] [media] saa7164: Improve a size determination in two functions SF Markus Elfring
2017-09-03 20:33 ` [PATCH 3/7] [media] Hexium Gemini: Delete an error message for a failed memory allocation in hexium_attach() SF Markus Elfring
2017-09-03 20:34 ` [PATCH 4/7] [media] Hexium Gemini: Improve a size determination " SF Markus Elfring
2017-09-03 20:35 ` [PATCH 5/7] [media] Hexium Orion: Delete an error message for a failed memory allocation in hexium_probe() SF Markus Elfring
2017-09-03 20:36 ` [PATCH 6/7] [media] Hexium Orion: Improve a size determination " SF Markus Elfring
2017-09-03 20:37 ` [PATCH 7/7] [media] Hexium Orion: Adjust one function call together with a variable assignment 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).