rtc: pic32: Move devm_rtc_allocate_device earlier in pic32_rtc_probe()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Wed, 23 Nov 2022 01:59:53 +0000 (09:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:37 +0000 (13:14 +0100)
commit35a174552bdec10375b1981707e382e46077f730
tree2b9f85bcc25b8e41ec6ac033140526ddafa8e88b
parenteea105c4e4b6887f4652d8f4936a9a431e3f4516
rtc: pic32: Move devm_rtc_allocate_device earlier in pic32_rtc_probe()

[ Upstream commit 90cd5c88830140c9fade92a8027e0fb2c6e4cc49 ]

The pic32_rtc_enable(pdata, 0) and clk_disable_unprepare(pdata->clk)
should be called in the error handling of devm_rtc_allocate_device(),
so we should move devm_rtc_allocate_device earlier in pic32_rtc_probe()
to fix it.

Fixes: 6515e23b9fde ("rtc: pic32: convert to devm_rtc_allocate_device")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20221123015953.1998521-1-cuigaosheng1@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-pic32.c