git: d6e7349254e3 - main - cam mmc: Assert that the xpt_bus_register registered a device_t

Warner Losh imp at FreeBSD.org
Mon Jun 28 22:24:04 UTC 2021


The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=d6e7349254e3d26bbecf105be28686a5eb976537

commit d6e7349254e3d26bbecf105be28686a5eb976537
Author:     Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-06-28 21:59:04 +0000
Commit:     Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-06-28 21:59:04 +0000

    cam mmc: Assert that the xpt_bus_register registered a device_t
    
    Reviewed by:            scottl@
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D30854
---
 sys/cam/mmc/mmc_xpt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c
index 6b2fecdab0fb..c94e74876ed7 100644
--- a/sys/cam/mmc/mmc_xpt.c
+++ b/sys/cam/mmc/mmc_xpt.c
@@ -406,8 +406,6 @@ mmccam_start_discovery(struct cam_sim *sim)
 	union ccb *ccb;
 	uint32_t pathid;
 
-	KASSERT(sim->sim_dev != NULL, ("mmccam_start_discovery(%s): sim_dev is not initialized,"
-	    " has cam_sim_alloc_dev() been used?", cam_sim_name(sim)));
 	pathid = cam_sim_path(sim);
 	ccb = xpt_alloc_ccb();
 
@@ -420,6 +418,10 @@ mmccam_start_discovery(struct cam_sim *sim)
 		xpt_free_ccb(ccb);
 		return;
 	}
+
+	KASSERT(xpt_path_sim_device(&ccb->ccb_h.path) != NULL,
+	    ("%s(%s): device is not initialized on sim's path",
+	    __func__, cam_sim_name(sim)));
 	xpt_rescan(ccb);
 }
 


More information about the dev-commits-src-main mailing list