mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
media: i2c: Fix camera driver Coverity defects
Fix the below Coverity defects for lt6911uxc driver Unchecked return value CID: 10174208 Dereference null return value CID: 10174210 Unchecked return value CID: 10175851 Bug 3952896 Change-Id: I43132879e31f8a27db8fd41c717d598fb2c33490 Signed-off-by: Ankur Pawar <ankurp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2915435 Reviewed-by: Praveen AC <pac@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Frank Chen <frankc@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
fc93f2390c
commit
0d04975aed
@@ -248,7 +248,7 @@ static int cam_power_get(struct cam *priv)
|
|||||||
const char *mclk_name;
|
const char *mclk_name;
|
||||||
const char *parentclk_name;
|
const char *parentclk_name;
|
||||||
struct clk *parent;
|
struct clk *parent;
|
||||||
int err = 0;
|
int err = 0, ret = 0;
|
||||||
|
|
||||||
struct camera_common_power_rail *pw = priv ? &priv->power : NULL;
|
struct camera_common_power_rail *pw = priv ? &priv->power : NULL;
|
||||||
struct camera_common_pdata *pdata = priv ? priv->pdata : NULL;
|
struct camera_common_pdata *pdata = priv ? priv->pdata : NULL;
|
||||||
@@ -272,8 +272,13 @@ static int cam_power_get(struct cam *priv)
|
|||||||
dev_err(&priv->i2c_client->dev,
|
dev_err(&priv->i2c_client->dev,
|
||||||
"unable to get parent clcok %s",
|
"unable to get parent clcok %s",
|
||||||
parentclk_name);
|
parentclk_name);
|
||||||
else
|
else {
|
||||||
clk_set_parent(pw->mclk, parent);
|
ret = clk_set_parent(pw->mclk, parent);
|
||||||
|
if (ret < 0)
|
||||||
|
dev_dbg(&priv->i2c_client->dev,
|
||||||
|
"%s unable to set parent clock %d\n",
|
||||||
|
__func__, ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ static int lt6911uxc_power_get(struct tegracam_device *tc_dev)
|
|||||||
struct camera_common_power_rail *pw = s_data->power;
|
struct camera_common_power_rail *pw = s_data->power;
|
||||||
struct camera_common_pdata *pdata = s_data->pdata;
|
struct camera_common_pdata *pdata = s_data->pdata;
|
||||||
struct clk *parent;
|
struct clk *parent;
|
||||||
int err = 0;
|
int err = 0, ret = 0;
|
||||||
|
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
dev_err(dev, "pdata missing\n");
|
dev_err(dev, "pdata missing\n");
|
||||||
@@ -153,8 +153,13 @@ static int lt6911uxc_power_get(struct tegracam_device *tc_dev)
|
|||||||
if (IS_ERR(parent)) {
|
if (IS_ERR(parent)) {
|
||||||
dev_err(dev, "unable to get parent clock %s",
|
dev_err(dev, "unable to get parent clock %s",
|
||||||
pdata->parentclk_name);
|
pdata->parentclk_name);
|
||||||
} else
|
} else {
|
||||||
clk_set_parent(pw->mclk, parent);
|
ret = clk_set_parent(pw->mclk, parent);
|
||||||
|
if (ret < 0)
|
||||||
|
dev_dbg(dev,
|
||||||
|
"%s unable to set parent clock %d\n",
|
||||||
|
__func__, ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,8 +513,16 @@ static void lt6911uxc_remove(struct i2c_client *client)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
|
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
|
||||||
struct lt6911uxc *priv = (struct lt6911uxc *)s_data->priv;
|
struct lt6911uxc *priv;
|
||||||
|
|
||||||
|
if (!s_data)
|
||||||
|
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
|
||||||
|
return -EINVAL;
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
priv = (struct lt6911uxc *)s_data->priv;
|
||||||
tegracam_v4l2subdev_unregister(priv->tc_dev);
|
tegracam_v4l2subdev_unregister(priv->tc_dev);
|
||||||
tegracam_device_unregister(priv->tc_dev);
|
tegracam_device_unregister(priv->tc_dev);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user