git: 7798b72a9000 - stable/14 - iichid(4): Do not send packets read in interrupt handler to hidbus

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Thu, 15 May 2025 18:17:51 UTC
The branch stable/14 has been updated by wulf:

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

commit 7798b72a90004cab0e6790060a18c00b87750341
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2025-04-28 21:39:28 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2025-05-15 18:13:41 +0000

    iichid(4): Do not send packets read in interrupt handler to hidbus
    
    if no hidbus and hidbus clients were attached and opened by users.
    
    iichid(4) enables interrupts before hidbus is attached and sending
    packets to it at this time leads to panic at boot time.
    
    Fixes: daa098cc37b9 ("Wait for RESET command response while attaching")
    
    Tested by:      dch
    PR:             286045
    MFC with:       daa098cc37b9
    
    (cherry picked from commit 2abdb305bd0c105226f6a71a8d3dc89698c9ef6b)
---
 sys/dev/iicbus/iichid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c
index 0e4aa649ff48..fc905ca48b7e 100644
--- a/sys/dev/iicbus/iichid.c
+++ b/sys/dev/iicbus/iichid.c
@@ -630,7 +630,7 @@ iichid_intr(void *context)
 	error = iichid_cmd_read(sc, sc->intr_buf, sc->intr_bufsize, &actual);
 	THREAD_NO_SLEEPING();
 	if (error == 0) {
-		if (sc->power_on) {
+		if (sc->power_on && sc->open) {
 			if (actual != 0)
 				sc->intr_handler(sc->intr_ctx, sc->intr_buf,
 				    actual);