mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: oe-kbuild@lists.linux.dev,
	Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: drivers/iio/accel/kionix-kx022a.c:1053 kx022a_probe_internal() warn: passing zero to 'dev_err_probe'
Date: Fri, 12 May 2023 08:49:52 +0300	[thread overview]
Message-ID: <f4ed65a9-4d7f-0b76-1b04-b0c85fabd8cd@gmail.com> (raw)
In-Reply-To: <f5f669fc-ebb4-46df-8957-84c714481ace@kili.mountain>

On 5/12/23 08:41, Dan Carpenter wrote:
> On Fri, May 12, 2023 at 08:16:02AM +0300, Matti Vaittinen wrote:
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1046  	irq = fwnode_irq_get_byname(fwnode, "INT1");
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1047  	if (irq > 0) {
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1048  		data->inc_reg = KX022A_REG_INC1;
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1049  		data->ien_reg = KX022A_REG_INC4;
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1050  	} else {
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1051  		irq = fwnode_irq_get_byname(fwnode, "INT2");
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24  1052  		if (irq <= 0)
>>>                                                                       ^^^^^^^^
>>> This code assumes fwnode_irq_get_byname() can return zero.
>>>
>>> 7c1d1677b3227c Matti Vaittinen 2022-10-24 @1053  			return dev_err_probe(dev, irq, "No suitable IRQ\n");
>>>
>>> But fortunately, it can't otherwise this would return success.
>>>
>>
>> Ouch. Actually, the fwnode_irq_get_byname() can return zero on device-tree
>> mapping error. I did actually send a patch to address this some time ago:
>> https://lore.kernel.org/lkml/cover.1666710197.git.mazziesaccount@gmail.com/
>>
> 
> Ah.  I just went by the documentation instead of looking at the code.
> 
> Originally a bunch of irq functions return NO_IRQ on error which was a
> design mistake...  irq_of_parse_and_map() still returns zero on error
> instead of negative error codes.  I wrote a check for that yesterday.
> 
> drivers/gpu/drm/msm/dsi/dsi_host.c:1949 msm_dsi_host_init() warn: irq_of_parse_and_map() returns zero on failure
> drivers/dma/ti/edma.c:2405 edma_probe() warn: irq_of_parse_and_map() returns zero on failure
> drivers/dma/ti/edma.c:2421 edma_probe() warn: irq_of_parse_and_map() returns zero on failure
> drivers/net/ethernet/xilinx/ll_temac_main.c:1570 temac_probe() warn: irq_of_parse_and_map() returns zero on failure
> drivers/net/ethernet/xilinx/ll_temac_main.c:1573 temac_probe() warn: irq_of_parse_and_map() returns zero on failure
> drivers/ata/sata_mv.c:4094 mv_platform_probe() warn: irq_of_parse_and_map() returns zero on failure
> 
> It would be good if we could apply your patch, otherwise I could create
> an explicit check for fwnode_irq_get_byname() returns.

I guess I can re-spin the series. Let's see if there is some good 
suggestion(s) on how to fix the i2c-smbus.

> Ideally, everything would just return negative error codes on error.

I definitely agree.


Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


      reply	other threads:[~2023-05-12  5:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 10:48 Dan Carpenter
2023-05-12  5:16 ` Matti Vaittinen
2023-05-12  5:41   ` Dan Carpenter
2023-05-12  5:49     ` Matti Vaittinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4ed65a9-4d7f-0b76-1b04-b0c85fabd8cd@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®