[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46299274-d827-279f-cadf-020e93296c13@hust.edu.cn>
Date: Mon, 24 Apr 2023 20:03:42 +0800
From: Dongliang Mu <dzm91@...t.edu.cn>
To: Mark Brown <broonie@...nel.org>, Li Ningke <lnk_01@...t.edu.cn>
Cc: hust-os-kernel-patches@...glegroups.com, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: davinci: Remove dead code in `davinci_spi_probe()`
On 2023/4/24 19:48, Mark Brown wrote:
> On Sun, Apr 23, 2023 at 03:24:46AM +0000, Li Ningke wrote:
>> Smatch complains that
>> drivers/spi/spi-davinci.c:915 davinci_spi_probe() warn:
>> platform_get_irq() does not return zero
>>
>> There is no need to check whether the return value is zero as
>> `platform_get_irq()` only returns non-zero IRQ number on success
>> or negative error number on failure, removing them to solve this
>> problem.
> Is that check valid? 0 was a valid interrupt for some architectures...
We just follow the comments of platform_get_irq().
/**
* platform_get_irq - get an IRQ for a device
* @dev: platform device
* @num: IRQ number index
*
* Gets an IRQ for a platform device and prints an error message if
finding the
* IRQ fails. Device drivers should check the return value for errors
so as to
* not pass a negative integer value to the request_irq() APIs.
*
* For example::
*
* int irq = platform_get_irq(pdev, 0);
* if (irq < 0)
* return irq;
*
* Return: non-zero IRQ number on success, negative error number on
failure.
*/
int platform_get_irq(struct platform_device *dev, unsigned int num)
{
int ret;
ret = platform_get_irq_optional(dev, num);
if (ret < 0)
return dev_err_probe(&dev->dev, ret,
"IRQ index %u not found\n", num);
return ret;
}
Powered by blists - more mailing lists