Re: [PATCH] extcon: max14577: Properly handle regmap_irq_get_virq error

From: Chanwoo Choi
Date: Mon Apr 21 2014 - 05:48:34 EST


On 04/18/2014 11:47 PM, Krzysztof Kozlowski wrote:
> The regmap_irq_get_virq may return 0 or -EINVAL on error. Fail the probe
> in both situations.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>
> ---
> drivers/extcon/extcon-max14577.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
> index 3846941801b8..d58747d2ddfa 100644
> --- a/drivers/extcon/extcon-max14577.c
> +++ b/drivers/extcon/extcon-max14577.c
> @@ -650,7 +650,7 @@ static int max14577_muic_probe(struct platform_device *pdev)
> unsigned int virq = 0;
>
> virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq);
> - if (!virq)
> + if (virq <= 0)
> return -EINVAL;
> muic_irq->virq = virq;

Applied it.

But,
IMO, Generally, if function completed the operation without problem,
return zero(0). But, irq_create_mapping() returns zero(0) when error happen.
It is necessary to modify irq_create_mapping(kernel/irq/irqdomain.c) about return value.

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/