aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2013-10-29 04:19:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-29 19:58:18 -0400
commit7cf1a122b2f3bda5af837a2dbd7564f695301af0 (patch)
treefad1ce6ff0303e49852d15ce958cc7f10e31c341 /drivers/w1
parente6418fcc8adaa5c3911295cbe7ddd368b9788616 (diff)
w1-gpio: Detect of_gpio_error for first gpio
The first DT gpio is necessary for this driver, but errors returned for of_get_gpio are ignored. This patch adds a return value check for the first of_get_gpio. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/masters/w1-gpio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index f54ece268c98..ae53e8832845 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -58,6 +58,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev)
58{ 58{
59 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; 59 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
60 struct device_node *np = pdev->dev.of_node; 60 struct device_node *np = pdev->dev.of_node;
61 int gpio;
61 62
62 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 63 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
63 if (!pdata) 64 if (!pdata)
@@ -66,7 +67,11 @@ static int w1_gpio_probe_dt(struct platform_device *pdev)
66 if (of_get_property(np, "linux,open-drain", NULL)) 67 if (of_get_property(np, "linux,open-drain", NULL))
67 pdata->is_open_drain = 1; 68 pdata->is_open_drain = 1;
68 69
69 pdata->pin = of_get_gpio(np, 0); 70 gpio = of_get_gpio(np, 0);
71 if (gpio < 0)
72 return gpio;
73 pdata->pin = gpio;
74
70 pdata->ext_pullup_enable_pin = of_get_gpio(np, 1); 75 pdata->ext_pullup_enable_pin = of_get_gpio(np, 1);
71 pdev->dev.platform_data = pdata; 76 pdev->dev.platform_data = pdata;
72 77