* [PATCH v2] ata: sata_mv: Fix the error handling of mv_chip_id()
@ 2021-10-22 9:12 Zheyu Ma
2021-10-25 0:00 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Zheyu Ma @ 2021-10-22 9:12 UTC (permalink / raw)
To: damien.lemoal; +Cc: linux-ide, linux-kernel, Zheyu Ma
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;
--
2.17.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ata: sata_mv: Fix the error handling of mv_chip_id()
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
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2021-10-25 0:00 UTC (permalink / raw)
To: Zheyu Ma; +Cc: linux-ide
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-25 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).