Re: [PATCH -next] i2c: stm32: fix the return value handle for platform_get_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2023/8/2 7:52, Andi Shyti wrote:
> Hi Ruan,
> 
> Just a nitpick here that does not affect my r-b...
> 
>> On Mon, Jul 31, 2023 at 07:27:55PM +0800, Ruan Jinjie wrote:
>>> There is no possible for platform_get_irq() to return 0,
>>> and the return value of platform_get_irq() is more sensible
>>> to show the error reason.
> 
> can we rephrase the whole commit to:
> 
>   i2c: stm32: Do not check for 0 return after calling platform_get_irq()
>   
>   It is not possible for platform_get_irq() to return 0. Use the
>   return value from platform_get_irq().
> 
> Two notes on the commit log:
> 
>  - Use capital letter after "i2c: stm32: Fix..."
>  - This is not a fix, so that we shouldn't use the word "fix" in
>    the title.
> 
> just little notes for future patches :)
Thank you for your valuable advice! I will keep an eye out for these in
future patches.

> 
> Thanks,
> Andi
> 
>>> Signed-off-by: Ruan Jinjie <ruanjinjie@xxxxxxxxxx>
>>> ---
>>>  drivers/i2c/busses/i2c-stm32f7.c | 8 ++++----
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
>>> index e897d9101434..579b30581725 100644
>>> --- a/drivers/i2c/busses/i2c-stm32f7.c
>>> +++ b/drivers/i2c/busses/i2c-stm32f7.c
>>> @@ -2121,12 +2121,12 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>>>  	phy_addr = (dma_addr_t)res->start;
>>>  
>>>  	irq_event = platform_get_irq(pdev, 0);
>>> -	if (irq_event <= 0)
>>> -		return irq_event ? : -ENOENT;
>>> +	if (irq_event < 0)
>>> +		return irq_event;
>>>  
>>>  	irq_error = platform_get_irq(pdev, 1);
>>> -	if (irq_error <= 0)
>>> -		return irq_error ? : -ENOENT;
>>> +	if (irq_error < 0)
>>> +		return irq_error;
>>
>> Correct, from patch ce753ad1549cbe ("platform: finally disallow
>> IRQ0 in platform_get_irq() and its ilk") this check is already
>> done inside platform_get_irq();
>>
>> Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx> 
>>
>> Andi
>>
>>>  
>>>  	i2c_dev->wakeup_src = of_property_read_bool(pdev->dev.of_node,
>>>  						    "wakeup-source");
>>> -- 
>>> 2.34.1
>>>



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux