diff mbox series

[2/3] serial: sh-sci: Use dev_err_probe()

Message ID 5c4dd8df1f8d0d14786f26ee80b77f3eb8e06cd5.1639663832.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series serial: sh-sci: Clock handling improvements | expand

Commit Message

Geert Uytterhoeven Dec. 16, 2021, 2:17 p.m. UTC
Use the dev_err_probe() helper to streamline error handling.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/tty/serial/sh-sci.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Laurent Pinchart Dec. 16, 2021, 2:52 p.m. UTC | #1
Hi Geert,

Thank you for the patch.

On Thu, Dec 16, 2021 at 03:17:33PM +0100, Geert Uytterhoeven wrote:
> Use the dev_err_probe() helper to streamline error handling.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/tty/serial/sh-sci.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 686ca1777222b1d4..5f6d85b8e3dd4173 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -2790,15 +2790,12 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
>  			 * global "peripheral_clk" clock.
>  			 */
>  			clk = devm_clk_get(dev, "peripheral_clk");
> -			if (!IS_ERR(clk))
> -				goto found;
> -
> -			dev_err(dev, "failed to get %s (%ld)\n", clk_names[i],
> -				PTR_ERR(clk));
> -			return PTR_ERR(clk);
> +			if (IS_ERR(clk))
> +				return dev_err_probe(dev, PTR_ERR(clk),
> +						     "failed to get %s\n",
> +						     clk_names[i]);
>  		}
>  
> -found:
>  		if (IS_ERR(clk))
>  			dev_dbg(dev, "failed to get %s (%ld)\n", clk_names[i],
>  				PTR_ERR(clk));
Wolfram Sang Dec. 16, 2021, 3:18 p.m. UTC | #2
On Thu, Dec 16, 2021 at 03:17:33PM +0100, Geert Uytterhoeven wrote:
> Use the dev_err_probe() helper to streamline error handling.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
diff mbox series

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 686ca1777222b1d4..5f6d85b8e3dd4173 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2790,15 +2790,12 @@  static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
 			 * global "peripheral_clk" clock.
 			 */
 			clk = devm_clk_get(dev, "peripheral_clk");
-			if (!IS_ERR(clk))
-				goto found;
-
-			dev_err(dev, "failed to get %s (%ld)\n", clk_names[i],
-				PTR_ERR(clk));
-			return PTR_ERR(clk);
+			if (IS_ERR(clk))
+				return dev_err_probe(dev, PTR_ERR(clk),
+						     "failed to get %s\n",
+						     clk_names[i]);
 		}
 
-found:
 		if (IS_ERR(clk))
 			dev_dbg(dev, "failed to get %s (%ld)\n", clk_names[i],
 				PTR_ERR(clk));