mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
nv_hawk_owl: add error check for reading gpio prop
Add error checks for reading GPIO properties from device-tree nodes in nv_hawk_owl driver. Bug 4715132 Change-Id: I6f539d04430883ab839aeaab957809ebb6049238 Signed-off-by: Shubham Chandra <shubhamc@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3168601 Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
This commit is contained in:
committed by
Jon Hunter
parent
f6fab5cebe
commit
7b1b8e17b5
@@ -926,7 +926,7 @@ static struct camera_common_pdata *ar0234_parse_dt(struct tegracam_device *tc_de
|
|||||||
struct camera_common_pdata *board_priv_pdata;
|
struct camera_common_pdata *board_priv_pdata;
|
||||||
const struct of_device_id *match;
|
const struct of_device_id *match;
|
||||||
int err;
|
int err;
|
||||||
int gpio = 0;
|
int pwr_gpio = 0;
|
||||||
if (!node)
|
if (!node)
|
||||||
return NULL;
|
return NULL;
|
||||||
match = of_match_device(ar0234_of_match, dev);
|
match = of_match_device(ar0234_of_match, dev);
|
||||||
@@ -939,23 +939,36 @@ static struct camera_common_pdata *ar0234_parse_dt(struct tegracam_device *tc_de
|
|||||||
&board_priv_pdata->mclk_name);
|
&board_priv_pdata->mclk_name);
|
||||||
if (err)
|
if (err)
|
||||||
dev_err(dev, "mclk not in DT\n");
|
dev_err(dev, "mclk not in DT\n");
|
||||||
|
|
||||||
board_priv_pdata->reset_gpio = of_get_named_gpio(node,
|
board_priv_pdata->reset_gpio = of_get_named_gpio(node,
|
||||||
"reset-gpios", 0);
|
"reset-gpios", 0);
|
||||||
|
if (board_priv_pdata->reset_gpio > 0)
|
||||||
gpio_direction_output(board_priv_pdata->reset_gpio, 1);
|
gpio_direction_output(board_priv_pdata->reset_gpio, 1);
|
||||||
|
else
|
||||||
|
dev_dbg(dev, "failed to read reset_gpio\n");
|
||||||
|
|
||||||
board_priv_pdata->pwdn_gpio = of_get_named_gpio(node,
|
board_priv_pdata->pwdn_gpio = of_get_named_gpio(node,
|
||||||
"pwdn-gpios", 0);
|
"pwdn-gpios", 0);
|
||||||
|
if (board_priv_pdata->pwdn_gpio > 0)
|
||||||
gpio_direction_output(board_priv_pdata->pwdn_gpio, 1);
|
gpio_direction_output(board_priv_pdata->pwdn_gpio, 1);
|
||||||
gpio = of_get_named_gpio(node,
|
else
|
||||||
|
dev_dbg(dev, "failed to read pwdn_gpio\n");
|
||||||
|
|
||||||
|
pwr_gpio = of_get_named_gpio(node,
|
||||||
"pwr-gpios", 0);
|
"pwr-gpios", 0);
|
||||||
gpio_direction_output(gpio, 1);
|
if (pwr_gpio > 0)
|
||||||
|
gpio_direction_output(pwr_gpio, 1);
|
||||||
|
else
|
||||||
|
dev_dbg(dev, "failed to read pwr_gpio\n");
|
||||||
|
|
||||||
board_priv_pdata->has_eeprom =
|
board_priv_pdata->has_eeprom =
|
||||||
of_property_read_bool(node, "has-eeprom");
|
of_property_read_bool(node, "has-eeprom");
|
||||||
|
|
||||||
if (board_priv_pdata->has_eeprom) {
|
if (board_priv_pdata->has_eeprom) {
|
||||||
err = of_property_read_u32(node, "eeprom-addr", &board_priv_pdata->eeprom_id_addr);
|
err = of_property_read_u32(node, "eeprom-addr", &board_priv_pdata->eeprom_id_addr);
|
||||||
if (err)
|
if (err)
|
||||||
dev_err(dev, "Failed to read eeprom addr\n");
|
dev_err(dev, "Failed to read eeprom addr\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return board_priv_pdata;
|
return board_priv_pdata;
|
||||||
}
|
}
|
||||||
static int ar0234_set_mode(struct tegracam_device *tc_dev)
|
static int ar0234_set_mode(struct tegracam_device *tc_dev)
|
||||||
|
|||||||
Reference in New Issue
Block a user