From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>, dayou5941@163.com
Cc: linux-ide@vger.kernel.org, liyouhong@kylinos.cn
Subject: Re: [PATCH v4] ata: ahci: fail probe if BAR too small for claimed ports
Date: Tue, 28 Apr 2026 00:10:23 +0200 [thread overview]
Message-ID: <84062023-B38D-434B-98BE-8ABC711CE560@kernel.org> (raw)
In-Reply-To: <b135fcde-bff7-4725-87a7-3d3126af9007@kernel.org>
On 27 April 2026 23:47:41 CEST, Damien Le Moal <dlemoal@kernel.org> wrote:
>On 2026/04/28 5:32, Niklas Cassel wrote:
>> On 27 April 2026 22:23:12 CEST, Damien Le Moal <dlemoal@kernel.org> wrote:
>>> On 2026/04/27 21:14, Niklas Cassel wrote:
>>>>> + max_ports, last_port_end,
>>>>> + (unsigned long long)bar_size);
>>>>
>>>> Print resource_size_t as %pa instead of casting to unsigned long long
>>>> and pass bar_size by reference (&bar_size):
>>>> https://docs.kernel.org/core-api/printk-formats.html#physical-address-types-phys-addr-t
>>>>
>>>>
>>>>> + return -ENODEV;
>>>>
>>>> return -EIO;
>>>
>>> I do not agree here. We did not do any I/O. If anything, this should be EINVAL.
>>> But I think that ENODEV is safer since we are in the probe context here and we
>>> do not want to see that device show up.
>>
>>
>> How about -ENXIO?
>>
>> No such device or address
>>
>>
>> It is the only error code, except for -ENODEV
>> that is a valid error code to fail probe():
>> https://elixir.bootlin.com/linux/v7.0.1/source/drivers/base/dd.c#L653
>
>That is my point, since we want to fail probe. So I would go with this ENODEV.
ENXIO and ENODEV are handled exactly the same way in dd.c
Anyway, looking at dd.c again, any negative error code will do. The only difference seems to be that the driver core will not print an error for ENXIO and ENODEV, but will do so for any other error code.
Looking at:
https://linux.kernel.narkive.com/NI9fvCoJ/device-driver-probe-return-codes
I don't think that my original suggestion of EIO is wrong.
Anyway, considering that all error codes will fail the probe, I'm fine with any error code (except for EPROBE_DEFER :P)
Kind regards,
Niklas
prev parent reply other threads:[~2026-04-27 22:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 6:05 [PATCH v4] ata: ahci: fail probe if BAR too small for claimed ports dayou5941
2026-04-27 12:14 ` Niklas Cassel
2026-04-27 20:23 ` Damien Le Moal
2026-04-27 20:32 ` Niklas Cassel
2026-04-27 21:47 ` Damien Le Moal
2026-04-27 22:10 ` Niklas Cassel [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=84062023-B38D-434B-98BE-8ABC711CE560@kernel.org \
--to=cassel@kernel.org \
--cc=dayou5941@163.com \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
/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