pwm: atmel-tcb: Harmonize resource allocation order
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 19 Jul 2023 19:20:09 +0000 (21:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:27:59 +0000 (12:27 +0200)
commitc42256a283d607a95be6906412279a7ff3edcaba
treea2cc1bc92cf6c4de289122f9d2cbf9bed785c6e3
parentb9734e8505bd8094e028ad43add9aa0188f82142
pwm: atmel-tcb: Harmonize resource allocation order

[ Upstream commit 0323e8fedd1ef25342cf7abf3a2024f5670362b8 ]

Allocate driver data as first resource in the probe function. This way it
can be used during allocation of the other resources (instead of assigning
these to local variables first and update driver data only when it's
allocated). Also as driver data is allocated using a devm function this
should happen first to have the order of freeing resources in the error
path and the remove function in reverse.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Stable-dep-of: c11622324c02 ("pwm: atmel-tcb: Fix resource freeing in error path and remove")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-atmel-tcb.c