diff mbox series

[v3,32/37] ARM: davinci: cp-intc: unify error handling

Message ID 20190212103835.7768-33-brgl@bgdev.pl (mailing list archive)
State New, archived
Headers show
Series ARM: davinci: modernize the irq support | expand

Commit Message

Bartosz Golaszewski Feb. 12, 2019, 10:38 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Use WARN_ON() on eny error in cp-intc initialization and drop all
custom error messages.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: David Lechner <david@lechnology.com>
---
 arch/arm/mach-davinci/cp_intc.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Marc Zyngier Feb. 14, 2019, 11:11 a.m. UTC | #1
On Tue, 12 Feb 2019 10:38:30 +0000,
Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Use WARN_ON() on eny error in cp-intc initialization and drop all
> custom error messages.

This isn't what this patch is doing.

Thanks,

	M.

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Reviewed-by: David Lechner <david@lechnology.com>
> ---
>  arch/arm/mach-davinci/cp_intc.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
> index 25221dfe8a20..1bf11fa8be76 100644
> --- a/arch/arm/mach-davinci/cp_intc.c
> +++ b/arch/arm/mach-davinci/cp_intc.c
> @@ -177,8 +177,10 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config,
>  
>  	davinci_cp_intc_base = ioremap(config->reg.start,
>  				       resource_size(&config->reg));
> -	if (WARN_ON(!davinci_cp_intc_base))
> +	if (!davinci_cp_intc_base) {
> +		pr_err("%s: unable to ioremap register range\n", __func__);
>  		return -EINVAL;
> +	}
>  
>  	davinci_cp_intc_write(0, DAVINCI_CP_INTC_GLOBAL_ENABLE);
>  
> @@ -210,8 +212,9 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config,
>  
>  	irq_base = irq_alloc_descs(-1, 0, config->num_irqs, 0);
>  	if (irq_base < 0) {
> -		pr_warn("Couldn't allocate IRQ numbers\n");
> -		irq_base = 0;
> +		pr_err("%s: unable to allocate interrupt descriptors: %d\n",
> +		       __func__, irq_base);
> +		return irq_base;
>  	}
>  
>  	/* create a legacy host */
> @@ -220,7 +223,7 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config,
>  					&davinci_cp_intc_irq_domain_ops, NULL);
>  
>  	if (!davinci_cp_intc_irq_domain) {
> -		pr_err("cp_intc: failed to allocate irq host!\n");
> +		pr_err("%s: unable to create an interrupt domain\n", __func__);
>  		return -EINVAL;
>  	}
>  
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
index 25221dfe8a20..1bf11fa8be76 100644
--- a/arch/arm/mach-davinci/cp_intc.c
+++ b/arch/arm/mach-davinci/cp_intc.c
@@ -177,8 +177,10 @@  davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config,
 
 	davinci_cp_intc_base = ioremap(config->reg.start,
 				       resource_size(&config->reg));
-	if (WARN_ON(!davinci_cp_intc_base))
+	if (!davinci_cp_intc_base) {
+		pr_err("%s: unable to ioremap register range\n", __func__);
 		return -EINVAL;
+	}
 
 	davinci_cp_intc_write(0, DAVINCI_CP_INTC_GLOBAL_ENABLE);
 
@@ -210,8 +212,9 @@  davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config,
 
 	irq_base = irq_alloc_descs(-1, 0, config->num_irqs, 0);
 	if (irq_base < 0) {
-		pr_warn("Couldn't allocate IRQ numbers\n");
-		irq_base = 0;
+		pr_err("%s: unable to allocate interrupt descriptors: %d\n",
+		       __func__, irq_base);
+		return irq_base;
 	}
 
 	/* create a legacy host */
@@ -220,7 +223,7 @@  davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config,
 					&davinci_cp_intc_irq_domain_ops, NULL);
 
 	if (!davinci_cp_intc_irq_domain) {
-		pr_err("cp_intc: failed to allocate irq host!\n");
+		pr_err("%s: unable to create an interrupt domain\n", __func__);
 		return -EINVAL;
 	}