git: da2f833f7a0b - main - MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c

Bjoern A. Zeeb bz at FreeBSD.org
Wed Jul 7 00:43:58 UTC 2021


The branch main has been updated by bz:

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

commit da2f833f7a0bef3cde7d5fc2a05e4646e873567f
Author:     Bjoern A. Zeeb <bz at FreeBSD.org>
AuthorDate: 2021-07-07 00:37:45 +0000
Commit:     Bjoern A. Zeeb <bz at FreeBSD.org>
CommitDate: 2021-07-07 00:37:45 +0000

    MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c
    
    During the removal of cam_sim_alloc_dev() in
    aeb04e88f51a706ef4b6a380bf5e82d15203fb6a for sdhci.c and the
    follow-up build-fix in a72af82e3169fcacfedf9047120679300a4296f8
    slot->dev and slot->bus got mixed up for MMCCAM;  slot->dev is
    only used in the !MMCCAM case so is uninitialised here leading to
    a panic;  switch back to slot->bus to return to the status quo.
    
    Reviewed by:    imp (ack on arm@)
    X-Differential Revision:        https://reviews.freebsd.org/D30857
---
 sys/dev/sdhci/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index bd30175e9f86..d075c2e05000 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -2484,7 +2484,7 @@ sdhci_start_slot(struct sdhci_slot *slot)
 
 	mtx_init(&slot->sim_mtx, "sdhcisim", NULL, MTX_DEF);
 	slot->sim = cam_sim_alloc(sdhci_cam_action, sdhci_cam_poll,
-	    "sdhci_slot", slot, device_get_unit(slot->dev),
+	    "sdhci_slot", slot, device_get_unit(slot->bus),
 	    &slot->sim_mtx, 1, 1, slot->devq);
 
 	if (slot->sim == NULL) {


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