Commit bea67aea authored by Srinivas Neeli's avatar Srinivas Neeli Committed by Linus Walleij

gpio: gpio-xilinx: Check return value of of_property_read_u32

In two different instances the return value of "of_property_read_u32"
API was neither captured nor checked.
Fixed it by capturing the return value and then checking for any error.
Signed-off-by: default avatarSrinivas Neeli <srinivas.neeli@xilinx.com>
Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
Addresses-Coverity: "check_return"
Link: https://lore.kernel.org/r/1605201148-4508-9-git-send-email-srinivas.neeli@xilinx.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 0230a41e
...@@ -298,7 +298,8 @@ static int xgpio_probe(struct platform_device *pdev) ...@@ -298,7 +298,8 @@ static int xgpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, chip); platform_set_drvdata(pdev, chip);
/* Update GPIO state shadow register with default value */ /* Update GPIO state shadow register with default value */
of_property_read_u32(np, "xlnx,dout-default", &chip->gpio_state[0]); if (of_property_read_u32(np, "xlnx,dout-default", &chip->gpio_state[0]))
chip->gpio_state[0] = 0x0;
/* Update GPIO direction shadow register with default value */ /* Update GPIO direction shadow register with default value */
if (of_property_read_u32(np, "xlnx,tri-default", &chip->gpio_dir[0])) if (of_property_read_u32(np, "xlnx,tri-default", &chip->gpio_dir[0]))
...@@ -318,8 +319,9 @@ static int xgpio_probe(struct platform_device *pdev) ...@@ -318,8 +319,9 @@ static int xgpio_probe(struct platform_device *pdev)
if (is_dual) { if (is_dual) {
/* Update GPIO state shadow register with default value */ /* Update GPIO state shadow register with default value */
of_property_read_u32(np, "xlnx,dout-default-2", if (of_property_read_u32(np, "xlnx,dout-default-2",
&chip->gpio_state[1]); &chip->gpio_state[1]))
chip->gpio_state[1] = 0x0;
/* Update GPIO direction shadow register with default value */ /* Update GPIO direction shadow register with default value */
if (of_property_read_u32(np, "xlnx,tri-default-2", if (of_property_read_u32(np, "xlnx,tri-default-2",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment