From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1AB3606A322 for ; Thu, 3 Dec 2026 17:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ZgAqhr9O; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=X0vYaiX7 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=TGM7y2jaSZtwube5QZ2lrvUbkoQteBLda3yScoPGKgs=; b=ZgAqhr9OL7sLjH tKG0qR/Z87Itu+XoNWRny5V61KR/b4vcMpPnuRJzEg/Qeek0RGdJ6F6BgSDk2wvCg2wqotoBI9woM DGPC92xsdwuJ/Og5696UmF75m8IpJFMazzCAVEnJDQWfb9kKchZyDbVn6zQu/iX3IEp6U9w1txN76 DN891X1VXyH2Hxv+2hSEYZCUQzg4GV7l9Kz6lTAqepiEo0KVbux6dghaW5mjlD5VnTPdusXICQaro ya1OlZ4GVYvNOcmoFb5HoWLSJIetPQXS77V7V6ggglb8X2t2qabhIf2yVoAW34U/I/RK0XjgaaErv Rx598OFQU1e9xedU6n/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZAz7-0000000FVkR-43aI; Thu, 03 Dec 2026 17:52:45 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZAz4-0000000FVia-0I88 for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 17:52:43 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-3b59bcb3301so734302a91.0 for ; Thu, 03 Dec 2026 09:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796320361; x=1796925161; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TGM7y2jaSZtwube5QZ2lrvUbkoQteBLda3yScoPGKgs=; b=X0vYaiX7s0WQqu7fDyfDE5yU3d++JnPTlx2dULoxgIoUlHIY7OocBz4gVXw0CPjrgw zHMZ6hsvgarmeEbGd5mnAcyjzdyUzd4vnksVxgaeo7BJYFkK0TrmBXKGL71NjE5+fGVm 6JY8QHqncopRfuDDsXn1a78VAaEjTeU0/srFOAbdxmaOZcYuZYSjhbDVNs09K4qrcG5C 7KccqLT2HQW4WqM+H23LEkZ/0bgZ/rPXktHd5plF/Yja91OgpC4WNgQg+/8YL5zHnZD3 cY6fDQG8yYZfhaUzqyiPmdCgkiAZzAjFxmOrh0dsao4QZBJ/V//m9CG07DQ2JM1fl61x 6TOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796320361; x=1796925161; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TGM7y2jaSZtwube5QZ2lrvUbkoQteBLda3yScoPGKg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R/ZO/2Ow2zlppiRfZVj7XUsGsHKiJFJcsb13pZxzygvmu1Vdm4iMDSoM0T/I2T Gowky7e5h/G0lsLSqssfPrgVuCEm0mgeIQdGVWdESDFYlXhTIuJ5ekyrLEjolUZOIKejR3e063A EYVYa4IzZd4EtiSXUy1eqXv8u1og30SEglLbeMzEh0SU4PiVGw== X-Received: by 2002:a17:90b:4c86:b0:3b0:9bfa:72ac with SMTP id 98e67ed59e1d1-3b5cb6a5761mr1749552a91.21.1796320360784; Thu, 03 Dec 2026 09:52:40 -0800 (PST) Received: from localhost.localdomain ([115.73.20.187]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d10d06sm5597590a91.3.2026.12.03.09.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 09:52:40 -0800 (PST) From: Nhat Tran To: afd@ti.com Cc: nm@ti.com, ssantosh@kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] soc: ti: wkup_m3_ipc: Use the device's own state in remove() Date: Fri, 4 Dec 2026 00:52:32 +0700 Message-Id: <20261203175232.57338-1-nhat.tranminhk2@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_095242_118511_AD87717D X-CRM114-Status: GOOD ( 15.95 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Dear Andrew, > Good find, but this fix is incomplete. You'll end up with the same NULL > dereference in `wkup_m3_ipc_resume()` should we go into suspend before > firmware is loaded, same for debugfs access before firmware. Thanks, you're right. I tested it on v1 and resume crashes too when the firmware is missing. > The core issue is that `m3_ipc_state` being set is used both to signal > the core is available, and access the device structure in functions that > can't get it through other means. It would be betterto split these two > which also solves the issue here. I sent v2 with this approach: https://lore.kernel.org/r/20261203174139.55646-1-nhat.tranminhk2@gmail.com I changed a few small things from your diff: >> struct wkup_m3_ipc *wkup_m3_ipc_get(void) >> { >> - if (m3_ipc_state) >> + if (m3_ipc_state->available) >> get_device(m3_ipc_state->dev); m3_ipc_state can still be NULL here, e.g. if pm33xx probes before wkup_m3_ipc. So I kept the NULL check: if (m3_ipc_state && m3_ipc_state->available) >> void wkup_m3_ipc_put(struct wkup_m3_ipc *m3_ipc) >> { >> - if (m3_ipc_state) >> + if (m3_ipc_state->available) >> put_device(m3_ipc_state->dev); >> } I left put() as it was. It should drop the reference even if the M3 is no longer available. Also m3_ipc_state is NULL again after remove(), so this would crash if pm33xx is removed after wkup_m3_ipc. >> @@ -601,7 +601,7 @@ static int wkup_m3_rproc_boot_thread(void *arg) >> if (ret) >> dev_err(dev, "rproc_boot failed\n"); >> else >> - m3_ipc_state = m3_ipc; >> + m3_ipc_state->available = true; The thread starts before probe sets m3_ipc_state, so I used m3_ipc->available here instead. Best Regards, Nhat Tran