Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Zheyu Ma <zheyuma97@gmail.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH v2] ata: sata_mv: Fix the error handling of mv_chip_id()
Date: Mon, 25 Oct 2021 09:00:52 +0900	[thread overview]
Message-ID: <3a3083f5-4843-5258-31ca-61a50cebbc1f@opensource.wdc.com> (raw)
In-Reply-To: <1634893946-16195-1-git-send-email-zheyuma97@gmail.com>

On 2021/10/22 18:12, 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.
> 
> Since this is a bug rather than a recoverable runtime error we should
> use dev_alert() instead of dev_err().
> 
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
> Changes in v2:
>     - Change the error code
>     - Change the logging function
> ---
>  drivers/ata/sata_mv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 9d86203e1e7a..c53633d47bfb 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -3896,8 +3896,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
>  		break;
>  
>  	default:
> -		dev_err(host->dev, "BUG: invalid board index %u\n", board_idx);
> -		return 1;
> +		dev_alert(host->dev, "BUG: invalid board index %u\n", board_idx);
> +		return -EINVAL;
>  	}
>  
>  	hpriv->hp_flags = hp_flags;
> 

Applied to for-5.15-fixes. Thanks !

-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2021-10-25  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  9:12 [PATCH v2] ata: sata_mv: Fix the error handling of mv_chip_id() Zheyu Ma
2021-10-25  0:00 ` Damien Le Moal [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=3a3083f5-4843-5258-31ca-61a50cebbc1f@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=linux-ide@vger.kernel.org \
    --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