Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725498 > unrolled thread

[PATCH 0/4] [media] ADV7...: Adjustments for four function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-09-02 15:10 +0200
Last post2017-09-02 15:20 +0200
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] [media] ADV7...: Adjustments for four function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 15:10 +0200
    [PATCH 1/4] [media] adv7604: Delete an error message for a failed  memory allocation in adv76xx_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 15:10 +0200
    [PATCH 2/4] [media] adv7604: Adjust a null pointer check in three  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 15:10 +0200
    [PATCH 4/4] [media] adv7842: Improve a size determination in  adv7842_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 15:20 +0200

#1725498 — [PATCH 0/4] [media] ADV7...: Adjustments for four function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-09-02 15:10 +0200
Subject[PATCH 0/4] [media] ADV7...: Adjustments for four function implementations
Message-ID<ulgls-3mm-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Sep 2017 14:49:43 +0200

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

Markus Elfring (4):
  Delete an error message for a failed memory allocation in adv76xx_probe()
  Adjust a null pointer check in three functions
  Delete an error message for a failed memory allocation in adv7842_probe()
  Improve a size determination in adv7842_probe()

 drivers/media/i2c/adv7604.c | 10 ++++------
 drivers/media/i2c/adv7842.c |  6 ++----
 2 files changed, 6 insertions(+), 10 deletions(-)

-- 
2.14.1

[toc] | [next] | [standalone]


#1725499 — [PATCH 1/4] [media] adv7604: Delete an error message for a failed memory allocation in adv76xx_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-09-02 15:10 +0200
Subject[PATCH 1/4] [media] adv7604: Delete an error message for a failed memory allocation in adv76xx_probe()
Message-ID<ulgls-3mm-9@gated-at.bofh.it>
In reply to#1725498
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Sep 2017 11:28:55 +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/i2c/adv7604.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 660bacb8f7d9..cc693ef71f33 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3319,7 +3319,5 @@ static int adv76xx_probe(struct i2c_client *client,
-	if (!state) {
-		v4l_err(client, "Could not allocate adv76xx_state memory!\n");
+	if (!state)
 		return -ENOMEM;
-	}
 
 	state->i2c_clients[ADV76XX_PAGE_IO] = client;
 
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1725500 — [PATCH 2/4] [media] adv7604: Adjust a null pointer check in three functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-09-02 15:10 +0200
Subject[PATCH 2/4] [media] adv7604: Adjust a null pointer check in three functions
Message-ID<ulgls-3mm-17@gated-at.bofh.it>
In reply to#1725498
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Sep 2017 11:43:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/i2c/adv7604.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cc693ef71f33..0a774d025858 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1948,7 +1948,7 @@ static int adv76xx_set_format(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	info = adv76xx_format_info(state, format->format.code);
-	if (info == NULL)
+	if (!info)
 		info = adv76xx_format_info(state, MEDIA_BUS_FMT_YUYV8_2X8);
 
 	adv76xx_fill_format(state, &format->format);
@@ -2256,7 +2256,7 @@ static int adv76xx_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
 		return 0;
 	}
 
-	if (data == NULL)
+	if (!data)
 		return -ENODATA;
 
 	if (edid->start_block >= state->edid.blocks)
@@ -3480,7 +3480,7 @@ static int adv76xx_probe(struct i2c_client *client,
 		state->i2c_clients[i] =
 			adv76xx_dummy_client(sd, state->pdata.i2c_addresses[i],
 					     0xf2 + i);
-		if (state->i2c_clients[i] == NULL) {
+		if (!state->i2c_clients[i]) {
 			err = -ENOMEM;
 			v4l2_err(sd, "failed to create i2c client %u\n", i);
 			goto err_i2c;
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1725503 — [PATCH 4/4] [media] adv7842: Improve a size determination in adv7842_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-09-02 15:20 +0200
Subject[PATCH 4/4] [media] adv7842: Improve a size determination in adv7842_probe()
Message-ID<ulgv7-3pE-7@gated-at.bofh.it>
In reply to#1725498
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Sep 2017 12:53:15 +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/i2c/adv7842.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 366a294edd7b..aa8b3bcdd750 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -3467,5 +3467,5 @@ static int adv7842_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
-	state = devm_kzalloc(&client->dev, sizeof(struct adv7842_state), GFP_KERNEL);
+	state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
 	if (!state)
-- 
2.14.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web