pwm: omap-dmtimer: Simplify error handling
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 11 Nov 2019 09:03:55 +0000 (10:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:29 +0000 (08:36 +0100)
commita3536e5589c7ddfb5955444ecb68ab3d432a4a0d
treec7fc51409de62a2ec298edaaab5efbe91c25f577
parent971579fae1b4e835887219526e1d7bc3d89b6f1a
pwm: omap-dmtimer: Simplify error handling

[ Upstream commit c4cf7aa57eb83b108d2d9c6c37c143388fee2a4d ]

Instead of doing error handling in the middle of ->probe(), move error
handling and freeing the reference to timer to the end.

This fixes a resource leak as dm_timer wasn't freed when allocating
*omap failed.

Implementation note: The put: label was never reached without a goto and
ret being unequal to 0, so the removed return statement is fine.

Fixes: 6604c6556db9 ("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: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-omap-dmtimer.c