pwm: omap-dmtimer: put_device() after of_find_device_by_node()
commit5.4-rM2-2.2.x-imx-squashedc7cb3a1dd5
upstream. This was found by coccicheck: drivers/pwm/pwm-omap-dmtimer.c:304:2-8: ERROR: missing put_device; call of_find_device_by_node on line 255, but without a corresponding object release within this function. Reported-by: Markus Elfring <elfring@users.sourceforge.net> Fixes:6604c6556d
("pwm: Add PWM driver for OMAP using dual-mode timers") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
parent
1fabae5c84
commit
f68b6a015a
|
@ -256,7 +256,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||||
if (!timer_pdev) {
|
if (!timer_pdev) {
|
||||||
dev_err(&pdev->dev, "Unable to find Timer pdev\n");
|
dev_err(&pdev->dev, "Unable to find Timer pdev\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto put;
|
goto err_find_timer_pdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_pdata = dev_get_platdata(&timer_pdev->dev);
|
timer_pdata = dev_get_platdata(&timer_pdev->dev);
|
||||||
|
@ -264,7 +264,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||||
dev_dbg(&pdev->dev,
|
dev_dbg(&pdev->dev,
|
||||||
"dmtimer pdata structure NULL, deferring probe\n");
|
"dmtimer pdata structure NULL, deferring probe\n");
|
||||||
ret = -EPROBE_DEFER;
|
ret = -EPROBE_DEFER;
|
||||||
goto put;
|
goto err_platdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata = timer_pdata->timer_ops;
|
pdata = timer_pdata->timer_ops;
|
||||||
|
@ -283,19 +283,19 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||||
!pdata->write_counter) {
|
!pdata->write_counter) {
|
||||||
dev_err(&pdev->dev, "Incomplete dmtimer pdata structure\n");
|
dev_err(&pdev->dev, "Incomplete dmtimer pdata structure\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto put;
|
goto err_platdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!of_get_property(timer, "ti,timer-pwm", NULL)) {
|
if (!of_get_property(timer, "ti,timer-pwm", NULL)) {
|
||||||
dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n");
|
dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto put;
|
goto err_timer_property;
|
||||||
}
|
}
|
||||||
|
|
||||||
dm_timer = pdata->request_by_node(timer);
|
dm_timer = pdata->request_by_node(timer);
|
||||||
if (!dm_timer) {
|
if (!dm_timer) {
|
||||||
ret = -EPROBE_DEFER;
|
ret = -EPROBE_DEFER;
|
||||||
goto put;
|
goto err_request_timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
|
omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
|
||||||
|
@ -352,7 +352,14 @@ err_pwmchip_add:
|
||||||
err_alloc_omap:
|
err_alloc_omap:
|
||||||
|
|
||||||
pdata->free(dm_timer);
|
pdata->free(dm_timer);
|
||||||
put:
|
err_request_timer:
|
||||||
|
|
||||||
|
err_timer_property:
|
||||||
|
err_platdata:
|
||||||
|
|
||||||
|
put_device(&timer_pdev->dev);
|
||||||
|
err_find_timer_pdev:
|
||||||
|
|
||||||
of_node_put(timer);
|
of_node_put(timer);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -372,6 +379,8 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
omap->pdata->free(omap->dm_timer);
|
omap->pdata->free(omap->dm_timer);
|
||||||
|
|
||||||
|
put_device(&omap->dm_timer_pdev->dev);
|
||||||
|
|
||||||
mutex_destroy(&omap->mutex);
|
mutex_destroy(&omap->mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue