clk: imx: scu: Use common error handling code in imx_clk_scu_alloc_dev()
PATCH 1/1 clk: imx: scu: Use common error handling code in imx_clk_scu_alloc_dev()
From: Markus Elfring <[email protected]>
Date: Fri, 22 Dec 2023 12:56:48 +0100
Add a jump target so that a bit of exception handling can be better reused at the end of this function.
Signed-off-by Markus Elfring <[email protected]>
--- drivers/clk/imx/clk-scu.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/clk/imx/clk-scu.c +10 -12
@@ -712,17 +712,13 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, } ret =platform_device_add_data (pdev, &clk,sizeof (clk)); -if (ret) { -platform_device_put (pdev); -return ERR_PTR (ret); - } +if (ret) + goto put_device; ret =driver_set_override (&pdev->dev, &pdev->driver_override,"imx-scu-clk" ,strlen ("imx-scu-clk" )); -if (ret) { -platform_device_put (pdev); -return ERR_PTR (ret); - } +if (ret) + goto put_device; ret =imx_clk_scu_attach_pd (&pdev->dev, rsrc_id);if (ret)
@@ -730,13 +726,15 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, name, ret); ret =platform_device_add (pdev); -if (ret) { -platform_device_put (pdev); -return ERR_PTR (ret); - } +if (ret) + goto put_device;/* For API backwards compatiblilty, simply return NULL for success */ return NULL ; + +put_device: +platform_device_put (pdev); +return ERR_PTR (ret); }void imx_clk_scu_unregister (void )
--
2.43.0
Quoted 7 lines · Markus Elfring
From: Markus Elfring<[email protected]>
Date: Fri, 22 Dec 2023 12:56:48 +0100Add a jump target so that a bit of exception handling can be better reused at the end of this function.
Signed-off-by Markus Elfring<[email protected]>
Reviewed-by Peng Fan <[email protected]>
Abel Vesa
AppliedQuoted 4 lines · Markus Elfring
Add a jump target so that a bit of exception handling can be better reused at the end of this function.
Applied, thanks!
[1/1] clk: imx: scu: Use common error handling code in imx_clk_scu_alloc_dev()
commit: e4818d3b3f621e996b5a1d1a4913d11ccf769c24
Best regards,
Signature · 1 line
Abel Vesa <[email protected]>