diff mbox series

media: stm32-dcmi: fix irq = 0 case

Message ID 1559294295-20573-1-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Headers show
Series media: stm32-dcmi: fix irq = 0 case | expand

Commit Message

Fabien DESSENNE May 31, 2019, 9:18 a.m. UTC
Manage the irq = 0 case, where we shall return an error.

Fixes: b5b5a27bee58 ("media: stm32-dcmi: return appropriate error codes during probe")
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/media/platform/stm32/stm32-dcmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Machek May 31, 2019, 9:30 a.m. UTC | #1
On Fri 2019-05-31 11:18:15, Fabien Dessenne wrote:
> Manage the irq = 0 case, where we shall return an error.
> 
> Fixes: b5b5a27bee58 ("media: stm32-dcmi: return appropriate error codes during probe")
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>

Acked-by: Pavel Machek <pavel@ucw.cz>
Reported-by: Pavel Machek <pavel@ucw.cz>

:-).
								Pavel

> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1702,7 +1702,7 @@ static int dcmi_probe(struct platform_device *pdev)
>  	if (irq <= 0) {
>  		if (irq != -EPROBE_DEFER)
>  			dev_err(&pdev->dev, "Could not get irq\n");
> -		return irq;
> +		return irq ? irq : -ENXIO;
>  	}
>  
>  	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Hans Verkuil June 3, 2019, 11:45 a.m. UTC | #2
On 5/31/19 11:18 AM, Fabien Dessenne wrote:
> Manage the irq = 0 case, where we shall return an error.
> 
> Fixes: b5b5a27bee58 ("media: stm32-dcmi: return appropriate error codes during probe")
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/media/platform/stm32/stm32-dcmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index b9dad0a..d855e9c 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1702,7 +1702,7 @@ static int dcmi_probe(struct platform_device *pdev)
>  	if (irq <= 0) {

Shouldn't this be 'irq < 0' instead of '<=' ?

AFAICT irq == 0 can be a valid irq and isn't an error.

Regards,

	Hans

>  		if (irq != -EPROBE_DEFER)
>  			dev_err(&pdev->dev, "Could not get irq\n");
> -		return irq;
> +		return irq ? irq : -ENXIO;
>  	}
>  
>  	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
Fabien DESSENNE June 3, 2019, 1:03 p.m. UTC | #3
Hi Hans


"platform_get_irq() = 0" shall be considered as an error. See these 
discussions:
https://patchwork.kernel.org/patch/10006651/
https://yarchive.net/comp/linux/zero.html

BR

Fabien

On 03/06/2019 1:45 PM, Hans Verkuil wrote:
> On 5/31/19 11:18 AM, Fabien Dessenne wrote:
>> Manage the irq = 0 case, where we shall return an error.
>>
>> Fixes: b5b5a27bee58 ("media: stm32-dcmi: return appropriate error codes during probe")
>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
>> ---
>>   drivers/media/platform/stm32/stm32-dcmi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
>> index b9dad0a..d855e9c 100644
>> --- a/drivers/media/platform/stm32/stm32-dcmi.c
>> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
>> @@ -1702,7 +1702,7 @@ static int dcmi_probe(struct platform_device *pdev)
>>   	if (irq <= 0) {
> Shouldn't this be 'irq < 0' instead of '<=' ?
>
> AFAICT irq == 0 can be a valid irq and isn't an error.
>
> Regards,
>
> 	Hans
>
>>   		if (irq != -EPROBE_DEFER)
>>   			dev_err(&pdev->dev, "Could not get irq\n");
>> -		return irq;
>> +		return irq ? irq : -ENXIO;
>>   	}
>>   
>>   	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>
Hans Verkuil June 3, 2019, 1:08 p.m. UTC | #4
On 6/3/19 3:03 PM, Fabien DESSENNE wrote:
> Hi Hans
> 
> 
> "platform_get_irq() = 0" shall be considered as an error. See these 
> discussions:
> https://patchwork.kernel.org/patch/10006651/
> https://yarchive.net/comp/linux/zero.html

Hmm, then many media drivers are wrong since most check for < 0.

In any case, I'll pick up this patch whenever I make a next pull request
for fixes like this.

Regards,

	Hans

> 
> BR
> 
> Fabien
> 
> On 03/06/2019 1:45 PM, Hans Verkuil wrote:
>> On 5/31/19 11:18 AM, Fabien Dessenne wrote:
>>> Manage the irq = 0 case, where we shall return an error.
>>>
>>> Fixes: b5b5a27bee58 ("media: stm32-dcmi: return appropriate error codes during probe")
>>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
>>> ---
>>>   drivers/media/platform/stm32/stm32-dcmi.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
>>> index b9dad0a..d855e9c 100644
>>> --- a/drivers/media/platform/stm32/stm32-dcmi.c
>>> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
>>> @@ -1702,7 +1702,7 @@ static int dcmi_probe(struct platform_device *pdev)
>>>   	if (irq <= 0) {
>> Shouldn't this be 'irq < 0' instead of '<=' ?
>>
>> AFAICT irq == 0 can be a valid irq and isn't an error.
>>
>> Regards,
>>
>> 	Hans
>>
>>>   		if (irq != -EPROBE_DEFER)
>>>   			dev_err(&pdev->dev, "Could not get irq\n");
>>> -		return irq;
>>> +		return irq ? irq : -ENXIO;
>>>   	}
>>>   
>>>   	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> >
diff mbox series

Patch

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index b9dad0a..d855e9c 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1702,7 +1702,7 @@  static int dcmi_probe(struct platform_device *pdev)
 	if (irq <= 0) {
 		if (irq != -EPROBE_DEFER)
 			dev_err(&pdev->dev, "Could not get irq\n");
-		return irq;
+		return irq ? irq : -ENXIO;
 	}
 
 	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);