diff mbox series

[v1,11/19] pinctrl: armada-37xx: Convert to use dev_err_probe()

Message ID 20211105124242.27288-11-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,01/19] lib/string_helpers: Introduce kasprintf_strarray() | expand

Commit Message

Andy Shevchenko Nov. 5, 2021, 12:42 p.m. UTC
It's fine to call dev_err_probe() in ->probe() when error code is known.
Convert the driver to use dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

Comments

Gregory CLEMENT Nov. 8, 2021, 10:59 a.m. UTC | #1
Hello Andy,

> It's fine to call dev_err_probe() in ->probe() when error code is known.
> Convert the driver to use dev_err_probe().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>

Thanks,

Gregory

> ---
>  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> index 282b3fac3bec..f48745c43419 100644
> --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> @@ -736,10 +736,8 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
>  			break;
>  		}
>  	}
> -	if (ret) {
> -		dev_err(dev, "no gpio-controller child node\n");
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "no gpio-controller child node\n");
>  
>  	nr_irq_parent = of_irq_count(np);
>  	spin_lock_init(&info->irq_lock);
> @@ -996,10 +994,8 @@ static int armada_37xx_pinctrl_register(struct platform_device *pdev,
>  		return ret;
>  
>  	info->pctl_dev = devm_pinctrl_register(dev, ctrldesc, info);
> -	if (IS_ERR(info->pctl_dev)) {
> -		dev_err(dev, "could not register pinctrl driver\n");
> -		return PTR_ERR(info->pctl_dev);
> -	}
> +	if (IS_ERR(info->pctl_dev))
> +		return dev_err_probe(dev, PTR_ERR(info->pctl_dev), "could not register pinctrl driver\n");
>  
>  	return 0;
>  }
> @@ -1135,10 +1131,8 @@ static int __init armada_37xx_pinctrl_probe(struct platform_device *pdev)
>  	info->dev = dev;
>  
>  	regmap = syscon_node_to_regmap(np);
> -	if (IS_ERR(regmap)) {
> -		dev_err(dev, "cannot get regmap\n");
> -		return PTR_ERR(regmap);
> -	}
> +	if (IS_ERR(regmap))
> +		return dev_err_probe(dev, PTR_ERR(regmap), "cannot get regmap\n");
>  	info->regmap = regmap;
>  
>  	info->data = of_device_get_match_data(dev);
> -- 
> 2.33.0
>
diff mbox series

Patch

diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index 282b3fac3bec..f48745c43419 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -736,10 +736,8 @@  static int armada_37xx_irqchip_register(struct platform_device *pdev,
 			break;
 		}
 	}
-	if (ret) {
-		dev_err(dev, "no gpio-controller child node\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "no gpio-controller child node\n");
 
 	nr_irq_parent = of_irq_count(np);
 	spin_lock_init(&info->irq_lock);
@@ -996,10 +994,8 @@  static int armada_37xx_pinctrl_register(struct platform_device *pdev,
 		return ret;
 
 	info->pctl_dev = devm_pinctrl_register(dev, ctrldesc, info);
-	if (IS_ERR(info->pctl_dev)) {
-		dev_err(dev, "could not register pinctrl driver\n");
-		return PTR_ERR(info->pctl_dev);
-	}
+	if (IS_ERR(info->pctl_dev))
+		return dev_err_probe(dev, PTR_ERR(info->pctl_dev), "could not register pinctrl driver\n");
 
 	return 0;
 }
@@ -1135,10 +1131,8 @@  static int __init armada_37xx_pinctrl_probe(struct platform_device *pdev)
 	info->dev = dev;
 
 	regmap = syscon_node_to_regmap(np);
-	if (IS_ERR(regmap)) {
-		dev_err(dev, "cannot get regmap\n");
-		return PTR_ERR(regmap);
-	}
+	if (IS_ERR(regmap))
+		return dev_err_probe(dev, PTR_ERR(regmap), "cannot get regmap\n");
 	info->regmap = regmap;
 
 	info->data = of_device_get_match_data(dev);