clk: mediatek: mtk: Implement error handling in register APIs
authorChen-Yu Tsai <wenst@chromium.org>
Tue, 8 Feb 2022 12:40:29 +0000 (20:40 +0800)
committerStephen Boyd <sboyd@kernel.org>
Thu, 17 Feb 2022 20:12:24 +0000 (12:12 -0800)
commit3c3ba2ab0226f9a4f4312a5db2dd402ec42392ca
treed81bd45aea9acaf6007b40094e2b967b57e0ea11
parent6ae34f2b7b8211a8d33a8b68dd5410f50e95bf0e
clk: mediatek: mtk: Implement error handling in register APIs

The remaining clk registration functions do not stop or return errors
if any clk failed to be registered, nor do they implement error
handling paths. This may result in a partially working device if any
step fails.

Make the register functions return proper error codes, and bail out if
errors occur. Proper cleanup, i.e. unregister any clks that were
successfully registered, is done in the new error path.

This also makes the |struct clk_data *| argument mandatory, as it is
used to track the list of clks registered.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Miles Chen <miles.chen@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220208124034.414635-27-wenst@chromium.org
Reviewed-by: Chun-Jie Chen <chun-jie.chen@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h