Skip to contentSkip to conversation

OmniVision: Adjustments for four function implementations

PATCH New SF Markus Elfring 1 participant 8 messages Sep 2, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover OmniVision: Adjustments for four function implementations

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 17:01:23 +0200

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

Markus Elfring (7):
Delete an error message for a failed memory allocation in ov2640_probe() Improve a size determination in ov2640_probe()
Delete an error message for a failed memory allocation in ov6650_probe() Delete an error message for a failed memory allocation in ov9640_probe() Improve a size determination in ov9640_probe()
Delete an error message for a failed memory allocation in ov9740_probe() Improve a size determination in ov9740_probe()

 drivers/media/i2c/ov2640.c            | 7 ++-----
 drivers/media/i2c/ov6650.c            | 5 +----
 drivers/media/i2c/soc_camera/ov9640.c | 7 ++-----
 drivers/media/i2c/soc_camera/ov9740.c | 6 ++----
 4 files changed, 7 insertions(+), 18 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/7 ov2640: Delete an error message for a failed memory allocation in ov2640_probe()

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:07:31 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/i2c/ov2640.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/i2c/ov2640.c +1 -4
index e6d0c1f64f0b..e4ae53410097 100644
@@ -1101,8 +1101,5 @@ static int ov2640_probe(struct i2c_client *client,
-	if (!priv) {
-		dev_err(&adapter->dev,
-			"Failed to allocate memory for private data!\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	if (client->dev.of_node) {
 		priv->clk = devm_clk_get(&client->dev, "xvclk");
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/7 ov2640: Improve a size determination in ov2640_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:09:35 +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.

---
 drivers/media/i2c/ov2640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2640.c +1 -1
index e4ae53410097..456aa977bce8 100644
@@ -1097,5 +1097,5 @@ static int ov2640_probe(struct i2c_client *client,
 		return -EIO;
 	}
 
-	priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL);
+	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
Signature · 1 line
2.14.1
#3 lore raw

PATCH 3/7 ov6650: Delete an error message for a failed memory allocation in ov6650_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:16:39 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/i2c/ov6650.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/i2c/ov6650.c +1 -4
index 768f2950ea36..8975d16b2b24 100644
@@ -954,8 +954,5 @@ static int ov6650_probe(struct i2c_client *client,
-	if (!priv) {
-		dev_err(&client->dev,
-			"Failed to allocate memory for private data!\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov6650_subdev_ops);
 	v4l2_ctrl_handler_init(&priv->hdl, 13);
Signature · 1 line
2.14.1
#4 lore raw

PATCH 4/7 ov9640: Delete an error message for a failed memory allocation in ov9640_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:34:27 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/i2c/soc_camera/ov9640.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/i2c/soc_camera/ov9640.c +1 -4
index 0146d1f7aacb..0f02f022f3e9 100644
@@ -679,8 +679,5 @@ static int ov9640_probe(struct i2c_client *client,
-	if (!priv) {
-		dev_err(&client->dev,
-			"Failed to allocate memory for private data!\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov9640_subdev_ops);
 
Signature · 1 line
2.14.1
#5 lore raw

PATCH 5/7 ov9640: Improve a size determination in ov9640_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:37:03 +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.

---
 drivers/media/i2c/soc_camera/ov9640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/soc_camera/ov9640.c +1 -1
index 0f02f022f3e9..67578f194928 100644
@@ -675,5 +675,5 @@ static int ov9640_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	priv = devm_kzalloc(&client->dev, sizeof(struct ov9640_priv), GFP_KERNEL);
+	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
Signature · 1 line
2.14.1
#6 lore raw

PATCH 6/7 ov9740: Delete an error message for a failed memory allocation in ov9740_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:44:36 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/i2c/soc_camera/ov9740.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/i2c/soc_camera/ov9740.c +1 -3
index cc07b7ae5407..f44f5da795f9 100644
@@ -939,7 +939,5 @@ static int ov9740_probe(struct i2c_client *client,
-	if (!priv) {
-		dev_err(&client->dev, "Failed to allocate private data!\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov9740_subdev_ops);
 	v4l2_ctrl_handler_init(&priv->hdl, 13);
Signature · 1 line
2.14.1
#7 lore raw

PATCH 7/7 ov9740: Improve a size determination in ov9740_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 2 Sep 2017 16:46:03 +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.

---
 drivers/media/i2c/soc_camera/ov9740.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/soc_camera/ov9740.c +1 -1
index f44f5da795f9..755de2289c39 100644
@@ -935,5 +935,5 @@ static int ov9740_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	priv = devm_kzalloc(&client->dev, sizeof(struct ov9740_priv), GFP_KERNEL);
+	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
Signature · 1 line
2.14.1