lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230520163049.3204f31b@jic23-huawei>
Date: Sat, 20 May 2023 16:30:49 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Matti Vaittinen <mazziesaccount@...il.com>
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>,
 Michael Hennerich <Michael.Hennerich@...log.com>, Andreas Klinger
 <ak@...klinger.de>, Marcin Wojtas <mw@...ihalf.com>, Russell King
 <linux@...linux.org.uk>, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
 Abeni <pabeni@...hat.com>, Jonathan Neuschäfer
 <j.neuschaefer@....net>, Linus Walleij <linus.walleij@...aro.org>, Paul
 Cercueil <paul@...pouillou.net>, 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,
 netdev@...r.kernel.org, openbmc@...ts.ozlabs.org,
 linux-gpio@...r.kernel.org, linux-mips@...r.kernel.org
Subject: Re: [PATCH v5 7/8] iio: cdc: ad7150: relax return value check for
 IRQ get

On Fri, 19 May 2023 14:04:32 +0300
Matti Vaittinen <mazziesaccount@...il.com> wrote:

> fwnode_irq_get[_byname]() were changed to not return 0 anymore. The
> special error case where device-tree based IRQ mapping fails can't no
> longer be reliably detected from this return value. This yields a
> functional change in the driver where the mapping failure is treated as
> an error.
> 
> The mapping failure can occur for example when the device-tree IRQ
> information translation call-back(s) (xlate) fail, IRQ domain is not
> found, IRQ type conflicts, etc. In most cases this indicates an error in
> the device-tree and special handling is not really required.
> 
> One more thing to note is that ACPI APIs do not return zero for any
> failures so this special handling did only apply on device-tree based
> systems.
> 
> Drop the special handling for DT mapping failures as these can no longer
> be separated from other errors at driver side.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
> 
> ---
> 
> Please note that I don't have the hardware to test this change.
> Furthermore, testing this type of device-tree error cases is not
> trivial, as the question we probably dive in is "what happens with the
> existing users who have errors in the device-tree". Answering to this
> question is not simple.
> 
> I did this patch with minimal code changes - but a question is if we
> should really jump into the else branch below on all IRQ getting errors?
> 
>         } else {
>                 indio_dev->info = &ad7150_info_no_irq;
>                 switch (id->driver_data) {
>                 case AD7150:
>                         indio_dev->channels = ad7150_channels_no_irq;
>                         indio_dev->num_channels =
>                                 ARRAY_SIZE(ad7150_channels_no_irq);
>                         break;
>                 case AD7151:
>                         indio_dev->channels = ad7151_channels_no_irq;
>                         indio_dev->num_channels =
>                                 ARRAY_SIZE(ad7151_channels_no_irq);
>                         break;
>                 default:
>                         return -EINVAL;
>                 }
> 
> Why do we have special handling for !chip->interrupts[0] while other
> errors on getting the fwnode_irq_get(dev_fwnode(&client->dev), 0); will
> abort the probe?

Gut feeling is that this was a rework of board file code where 0 meant not
provided. We should look to do the same here.  I'm not sure we have a consistent
return for no irq though across the various fw types.

The driver looks like it should support either no interrupts or all the
ones for a given device.

Currrently it definitely doesn't handle the no irqs provided case right.
Its not elegant, but if we have to have all failures to get irqs result
in carrying on without them then that's better than now.

Jonathan


> 
> The first patch of the series changes the fwnode_irq_get() so this depends
> on the first patch of the series and should not be applied alone.
> ---
>  drivers/iio/cdc/ad7150.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/cdc/ad7150.c b/drivers/iio/cdc/ad7150.c
> index 79aeb0aaea67..d7ba50b9780d 100644
> --- a/drivers/iio/cdc/ad7150.c
> +++ b/drivers/iio/cdc/ad7150.c
> @@ -567,8 +567,7 @@ static int ad7150_probe(struct i2c_client *client)
>  		if (chip->interrupts[1] < 0)
>  			return chip->interrupts[1];
>  	}
> -	if (chip->interrupts[0] &&
> -	    (id->driver_data == AD7151 || chip->interrupts[1])) {
> +	if (id->driver_data == AD7151 || chip->interrupts[1]) {
>  		irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN);
>  		ret = devm_request_threaded_irq(&client->dev,
>  						chip->interrupts[0],


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ