Re: [PATCH v2 2/9] libata: fix ata_host_start()

From
James Bottomley <James.Bottomley@HansenPartnership.com>
Date
2021-08-06 14:31:45
Also in
linux-ide, linux-scsi
Reply to
Damien Le Moal, 2021-08-06
On Fri, 2021-08-06 at 16:42 +0900, Damien Le Moal wrote:
quoted hunk ↗ jump to hunk
The loop on entry of ata_host_start() may not initialize host->ops to
a non NULL value. The test on the host_stop field of host->ops must
then be preceded by a check that host->ops is not NULL.

Reported-by: kernel test robot <redacted>
Signed-off-by: Damien Le Moal <redacted>
---
 drivers/ata/libata-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ea8b91297f12..fe49197caf99 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5573,7 +5573,7 @@ int ata_host_start(struct ata_host *host)
 			have_stop = 1;
 	}
 
-	if (host->ops->host_stop)
+	if (host->ops && host->ops->host_stop)
since have_stop was already set by the port ops, surely this entire if
is redundant?

James

Thread (27 messages) 27 messages, 4 authors, last reply 2021-08-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help