Fix a few smatch warnings
Subsystems (4)
Sakari Ailus
maintainercover Fix a few smatch warnings
Hi,
This small set fixes a few trivial smatch warnings. They're not really bugs either but changing the code cleans it up as well.
Sakari Ailus (2):
v4l2-fwnode: Avoid using PTR_ERR(NULL)
ov9640: Don't check for NULL on devm_gpiod_get return values
drivers/media/i2c/ov9640.c | 4 ++-- drivers/media/v4l2-core/v4l2-fwnode.c | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 1/2 v4l2-fwnode: Avoid using PTR_ERR(NULL)
PTR_ERR(NULL) yields 0 which is commonly used to denote success. This is the case here, and PTR_ERR(NULL) is apparently shunned upon. Fix this by explicitly returning 0 if fwnode == NULL.
--- drivers/media/v4l2-core/v4l2-fwnode.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-fwnode.c +1 -5
@@ -1098,11 +1098,7 @@ v4l2_fwnode_reference_parse_int_props(struct device *dev, } } -return PTR_ERR (fwnode) == -ENOENT ?0 :PTR_ERR (fwnode); - -error: -fwnode_handle_put (fwnode); -return ret; +return !fwnode ||PTR_ERR (fwnode) == -ENOENT ?0 :PTR_ERR (fwnode); } int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev,
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 1/2 v4l2-fwnode: Avoid using PTR_ERR(NULL)
PTR_ERR(NULL) yields 0 which is commonly used to denote success. This is the case here, and PTR_ERR(NULL) is apparently shunned upon. Fix this by explicitly returning 0 if fwnode == NULL.
---
since v1:
- Fix rebase mess.
drivers/media/v4l2-core/v4l2-fwnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-fwnode.c +1 -1
@@ -1098,7 +1098,7 @@ v4l2_fwnode_reference_parse_int_props(struct device *dev, } } -return PTR_ERR (fwnode) == -ENOENT ?0 :PTR_ERR (fwnode); +return !fwnode ||PTR_ERR (fwnode) == -ENOENT ?0 :PTR_ERR (fwnode); error:fwnode_handle_put (fwnode);
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 2/2 ov9640: Don't check for NULL on devm_gpiod_get return values
In reply to Sakari Ailusdevm_gpiod_get never returns NULL; therefore it's not necessary to check for that. PTR_ERR(NULL) also yields zero, which is confusing to smatch.
--- drivers/media/i2c/ov9640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov9640.c +2 -2
@@ -691,14 +691,14 @@ static int ov9640_probe(struct i2c_client *client, priv->gpio_power =devm_gpiod_get (&client->dev,"Camera power" ,GPIOD_OUT_LOW ); -if (IS_ERR_OR_NULL (priv->gpio_power)) { +if (IS_ERR (priv->gpio_power)) { ret =PTR_ERR (priv->gpio_power);return ret; } priv->gpio_reset =devm_gpiod_get (&client->dev,"Camera reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR_OR_NULL (priv->gpio_reset)) { +if (IS_ERR (priv->gpio_reset)) { ret =PTR_ERR (priv->gpio_reset);return ret; }
Signature · 1 line
2.11.0