Skip to content

Commit a0023bb

Browse files
ZheyuMaDamien Le Moal
authored andcommitted
ata: sata_mv: Fix the error handling of mv_chip_id()
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 <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 776c750 commit a0023bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/ata/sata_mv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3896,8 +3896,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
38963896
break;
38973897

38983898
default:
3899-
dev_err(host->dev, "BUG: invalid board index %u\n", board_idx);
3900-
return 1;
3899+
dev_alert(host->dev, "BUG: invalid board index %u\n", board_idx);
3900+
return -EINVAL;
39013901
}
39023902

39033903
hpriv->hp_flags = hp_flags;

0 commit comments

Comments
 (0)