[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0fb0ef4f-b310-0922-2823-e8737159bf26@gmail.com>
Date: Mon, 15 May 2023 15:07:02 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Wolfram Sang <wsa@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Akhil R <akhilrajeev@...dia.com>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: Re: [PATCH v3 1/3] drivers: fwnode: fix fwnode_irq_get_byname()
Hi Jonathan,
It was somewhat busy "Mother's day" weekend for me but now I'm back in
the business :)
On 5/13/23 21:40, Jonathan Cameron wrote:
> On Fri, 12 May 2023 10:53:00 +0300
> Matti Vaittinen <mazziesaccount@...il.com> wrote:
>
>> The fwnode_irq_get_byname() does return 0 upon device-tree IRQ mapping
>> failure. This is contradicting the function documentation and can
>> potentially be a source of errors like:
>>
>> int probe(...) {
>> ...
>>
>> irq = fwnode_irq_get_byname();
>> if (irq <= 0)
>> return irq;
>>
>> ...
>> }
>>
>> Here we do correctly check the return value from fwnode_irq_get_byname()
>> but the driver probe will now return success. (There was already one
>> such user in-tree).
>>
>> Change the fwnode_irq_get_byname() to work as documented and according to
>> the common convention and abd always return a negative errno upon failure.
>>
>> Fixes: ca0acb511c21 ("device property: Add fwnode_irq_get_byname")
>> Suggested-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
>> Reviewed-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
>
> Whilst the docs don't contradict behaviour for fwnode_irq_get()
> unlike the byname() variant, it does seem odd to fix it only in this
> version rather than modifying them both not to return 0.
I think you're right. I think I overlooked this because the whole thing
started as a documentation fix :)
> Is there clear logic why they should be different?
Not that I know of. I'll re-spin this with fwnode_irq_get() modified if
no-one objects. Thanks for pointing this out!
Yours,
-- Matti
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
Powered by blists - more mailing lists