From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Sergey Shtylyov <s.shtylyov@omp.ru>, Zheyu Ma <zheyuma97@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ata: sata_mv: Fix the return value of the probe function
Date: Thu, 21 Oct 2021 19:38:30 +0900 [thread overview]
Message-ID: <1d5064f6-0498-c78c-d98f-df7ca74e0a8d@opensource.wdc.com> (raw)
In-Reply-To: <e1f96f77-cf44-7783-bf88-0814bbabbfbc@omp.ru>
On 2021/10/21 17:37, Sergey Shtylyov wrote:
> On 21.10.2021 8:57, Zheyu Ma wrote:
>
>> mv_init_host() propagates the value returned by mv_chip_id() which in turn
>> gets propagated by mv_pci_init_one() and hits local_pci_probe().
>>
>> During the process of driver probing, the probe function should return < 0
>> for failure, otherwise, the kernel will treat value > 0 as success.
>>
>> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
>> ---
>> drivers/ata/sata_mv.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
>> index 9d86203e1e7a..7461fe078dd1 100644
>> --- a/drivers/ata/sata_mv.c
>> +++ b/drivers/ata/sata_mv.c
>> @@ -3897,7 +3897,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
>>
>> default:
>> dev_err(host->dev, "BUG: invalid board index %u\n", board_idx);
>> - return 1;
>> + return -ENODEV;
>
> Doesn't -EINVAL fit better here?
If the error message is correct and this can only happen if there is a bug
somewhere, I do not think the error code really matters much. The dev_err()
should probably be changed to dev_alert() or even dev_crit() for this case.
>
> [...]
>
> MBR, Sergey
>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2021-10-21 10:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 5:57 [PATCH] ata: sata_mv: Fix the return value of the probe function Zheyu Ma
2021-10-21 8:37 ` Sergey Shtylyov
2021-10-21 10:38 ` Damien Le Moal [this message]
2021-10-21 11:23 ` Zheyu Ma
2021-10-22 1:40 ` Damien Le Moal
2021-10-22 1:41 ` Damien Le Moal
2021-10-22 9:18 ` Zheyu Ma
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=1d5064f6-0498-c78c-d98f-df7ca74e0a8d@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=s.shtylyov@omp.ru \
--cc=zheyuma97@gmail.com \
/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