Skip to content

Commit

Permalink
clk: imx: scu: Use common error handling code in imx_clk_scu_alloc_dev()
Browse files Browse the repository at this point in the history
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]>
Reviewed-by: Peng Fan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Abel Vesa <[email protected]>
  • Loading branch information
elfring authored and abelvesa committed Feb 26, 2024
1 parent e1ed0b0 commit e4818d3
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions drivers/clk/imx/clk-scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,31 +712,29 @@ 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)
pr_warn("%s: failed to attached the power domain %d\n",
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)
Expand Down

0 comments on commit e4818d3

Please sign in to comment.