Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Srinivas Neeli <srinivas.neeli@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Addresses-Coverity: "check_return"
Link: https://lore.kernel.org/r/1605201148-4508-9-git-send-email-srinivas.neeli@xilinx.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Srinivas Neeli and committed by
Linus Walleij
bea67aea 0230a41e

+5 -3
+5 -3
drivers/gpio/gpio-xilinx.c
··· 298 298 platform_set_drvdata(pdev, chip); 299 299 300 300 /* Update GPIO state shadow register with default value */ 301 - of_property_read_u32(np, "xlnx,dout-default", &chip->gpio_state[0]); 301 + if (of_property_read_u32(np, "xlnx,dout-default", &chip->gpio_state[0])) 302 + chip->gpio_state[0] = 0x0; 302 303 303 304 /* Update GPIO direction shadow register with default value */ 304 305 if (of_property_read_u32(np, "xlnx,tri-default", &chip->gpio_dir[0])) ··· 319 318 320 319 if (is_dual) { 321 320 /* Update GPIO state shadow register with default value */ 322 - of_property_read_u32(np, "xlnx,dout-default-2", 323 - &chip->gpio_state[1]); 321 + if (of_property_read_u32(np, "xlnx,dout-default-2", 322 + &chip->gpio_state[1])) 323 + chip->gpio_state[1] = 0x0; 324 324 325 325 /* Update GPIO direction shadow register with default value */ 326 326 if (of_property_read_u32(np, "xlnx,tri-default-2",