media: i2c: Fix camera driver Coverity defects

Fix the below Coverity defects for OV5693

Dereference null return
CID: 10171403

Unchecked return value
CID: 10171401

Bug 3952896

Change-Id: I657cb0ae9a2baf6c6cac7faa84debb754582534d
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2885152
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Michael Stevens (SW-TEGRA) <michaelst@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ankur Pawar
2023-04-10 08:58:17 +00:00
committed by mobile promotions
parent 3d2b7e4ff8
commit c5fa6476ee

View File

@@ -324,8 +324,11 @@ static int ov5693_power_get(struct tegracam_device *tc_dev)
if (IS_ERR(parent)) {
dev_err(dev, "unable to get parent clcok %s",
parentclk_name);
} else
clk_set_parent(pw->mclk, parent);
} else {
ret = clk_set_parent(pw->mclk, parent);
if (ret < 0)
dev_dbg(dev, "%s failed to set parent clock %d\n", __func__, err);
}
}
/* analog 2.8v */
@@ -1241,8 +1244,17 @@ static void
ov5693_remove(struct i2c_client *client)
#endif
{
struct ov5693 *priv;
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
struct ov5693 *priv = (struct ov5693 *)s_data->priv;
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
return -EINVAL;
#else
return;
#endif
priv = (struct ov5693 *)s_data->priv;
ov5693_debugfs_remove(priv);