MLK-12176 Input: ads7846: add return value check after calling .of_property_read_u32()
authorFugang Duan <b38611@freescale.com>
Mon, 11 Jan 2016 06:40:32 +0000 (14:40 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:43 +0000 (14:49 -0500)
Add return value check after calling .of_property_read_u32().
The issue was reported by coverity.

Signed-off-by: Fugang Duan <B38611@freescale.com>
drivers/input/touchscreen/ads7846.c

index 1ce3ecb..fc21a74 100644 (file)
@@ -1188,6 +1188,7 @@ static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
        struct ads7846_platform_data *pdata;
        struct device_node *node = dev->of_node;
        const struct of_device_id *match;
+       int ret;
 
        if (!node) {
                dev_err(dev, "Device does not have associated DT data\n");
@@ -1233,8 +1234,11 @@ static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
        of_property_read_u16(node, "ti,debounce-tol", &pdata->debounce_tol);
        of_property_read_u16(node, "ti,debounce-rep", &pdata->debounce_rep);
 
-       of_property_read_u32(node, "ti,pendown-gpio-debounce",
+       ret = of_property_read_u32(node, "ti,pendown-gpio-debounce",
                             &pdata->gpio_pendown_debounce);
+       if (!ret)
+               dev_info(dev, "Set pendown gpio debounce time to %d microseconds\n",
+                        pdata->gpio_pendown_debounce);
 
        pdata->wakeup = of_property_read_bool(node, "wakeup-source") ||
                        of_property_read_bool(node, "linux,wakeup");