diff options
-rw-r--r-- | drivers/watchdog/wm831x_wdt.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 9dcb6d082277..3348ddd618c7 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c | |||
@@ -247,9 +247,10 @@ static int wm831x_wdt_probe(struct platform_device *pdev) | |||
247 | reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT; | 247 | reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT; |
248 | 248 | ||
249 | if (pdata->update_gpio) { | 249 | if (pdata->update_gpio) { |
250 | ret = gpio_request_one(pdata->update_gpio, | 250 | ret = devm_gpio_request_one(&pdev->dev, |
251 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, | 251 | pdata->update_gpio, |
252 | "Watchdog update"); | 252 | GPIOF_OUT_INIT_LOW, |
253 | "Watchdog update"); | ||
253 | if (ret < 0) { | 254 | if (ret < 0) { |
254 | dev_err(wm831x->dev, | 255 | dev_err(wm831x->dev, |
255 | "Failed to request update GPIO: %d\n", | 256 | "Failed to request update GPIO: %d\n", |
@@ -270,7 +271,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) | |||
270 | } else { | 271 | } else { |
271 | dev_err(wm831x->dev, | 272 | dev_err(wm831x->dev, |
272 | "Failed to unlock security key: %d\n", ret); | 273 | "Failed to unlock security key: %d\n", ret); |
273 | goto err_gpio; | 274 | goto err; |
274 | } | 275 | } |
275 | } | 276 | } |
276 | 277 | ||
@@ -278,16 +279,13 @@ static int wm831x_wdt_probe(struct platform_device *pdev) | |||
278 | if (ret != 0) { | 279 | if (ret != 0) { |
279 | dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n", | 280 | dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n", |
280 | ret); | 281 | ret); |
281 | goto err_gpio; | 282 | goto err; |
282 | } | 283 | } |
283 | 284 | ||
284 | dev_set_drvdata(&pdev->dev, driver_data); | 285 | dev_set_drvdata(&pdev->dev, driver_data); |
285 | 286 | ||
286 | return 0; | 287 | return 0; |
287 | 288 | ||
288 | err_gpio: | ||
289 | if (driver_data->update_gpio) | ||
290 | gpio_free(driver_data->update_gpio); | ||
291 | err: | 289 | err: |
292 | return ret; | 290 | return ret; |
293 | } | 291 | } |
@@ -298,9 +296,6 @@ static int wm831x_wdt_remove(struct platform_device *pdev) | |||
298 | 296 | ||
299 | watchdog_unregister_device(&driver_data->wdt); | 297 | watchdog_unregister_device(&driver_data->wdt); |
300 | 298 | ||
301 | if (driver_data->update_gpio) | ||
302 | gpio_free(driver_data->update_gpio); | ||
303 | |||
304 | return 0; | 299 | return 0; |
305 | } | 300 | } |
306 | 301 | ||