drivers: camera: fix Coverity warnings

Fix camera kernel drivers for the below warnings:

CID 10165214: Unchecked return value (CHECKED_RETURN)
CID 10165215: Unchecked return value (CHECKED_RETURN)
CID 10160154: Unsigned compared against 0 (NO_EFFECT)

Bug 3952896

Change-Id: I82727b5c298d0c39ebba2ae60f6ed76321272ff5
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2858894
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
Frank Chen
2023-02-15 11:42:18 -08:00
committed by mobile promotions
parent a0c0b2f212
commit dd1d0b6c70
3 changed files with 14 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
@@ -656,7 +656,7 @@ static int cdi_dev_probe(struct i2c_client *client,
for (i = 0; i < numLinks; i++) { for (i = 0; i < numLinks; i++) {
err = of_property_read_u32_index(child_max20087, "links", i, &link); err = of_property_read_u32_index(child_max20087, "links", i, &link);
if (err == 0) { if (err == 0) {
if ((link >= 0) && (link < MAX_POWER_LINKS_PER_BLOCK)) { if (link < MAX_POWER_LINKS_PER_BLOCK) {
info->max20087.links[i] = (u8) link; info->max20087.links[i] = (u8) link;
} else { } else {
dev_err(&client->dev, "%s: Incorrect camera module index: %d\n", dev_err(&client->dev, "%s: Incorrect camera module index: %d\n",

View File

@@ -159,9 +159,14 @@ static void camrtc_clk_group_error(
int error) int error)
{ {
const char *name = "unnamed"; const char *name = "unnamed";
int ret;
of_property_read_string_index(grp->device->of_node, ret = of_property_read_string_index(grp->device->of_node,
"clock-names", index, &name); "clock-names", index, &name);
if (ret < 0)
dev_warn(grp->device, "Cannot find clock in clock-names\n");
dev_warn(grp->device, "%s clk %s (at [%d]): failed (%d)\n", dev_warn(grp->device, "%s clk %s (at [%d]): failed (%d)\n",
op, name, index, error); op, name, index, error);
} }

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include "reset-group.h" #include "reset-group.h"
@@ -96,9 +96,13 @@ static void camrtc_reset_group_error(
int error) int error)
{ {
const char *name = "unnamed"; const char *name = "unnamed";
int ret;
of_property_read_string_index(grp->device->of_node, ret = of_property_read_string_index(grp->device->of_node,
grp->group_name, index, &name); grp->group_name, index, &name);
if (ret < 0)
dev_warn(grp->device, "Cannot find reset in %s\n", grp->group_name);
dev_warn(grp->device, "%s reset %s (at %s[%d]): %d\n", dev_warn(grp->device, "%s reset %s (at %s[%d]): %d\n",
op, name, grp->group_name, index, error); op, name, grp->group_name, index, error);
} }