From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796320362; b=dUyorTAnl3hneOsO7BzTZzxw9R4ISB+e4z4LsyXU3a6+ctkqCgP4GD/3Ogg8uYDRHQRD CFaIUDbrdpKTUbX0X0C81id1dNq41vcX6b9LbjoCf1lEZ1j6fmo/FcPpmuZHEbon2YO+K zm05L99gXp+gUGSsVAqJhCMpXkYemShSmkQmCfcvxxCZFUfgrfo4cIeW0W+jhADhMqeGs 0H1n+5iEbSUCv1r6JdtBiS8sGiVGMdBVrEuYBDAc9SkonA3CtkUQyY8LpaiB959PmMQe2 mrR5uXFfuUSlxDoEiuEpLpXP/2pIbG8ZMmrA7kQEA/OkQjr8GOoiQHau5hilwzhhsrQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796320362; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=TGM7y2jaSZtwube5QZ2lrvUbkoQteBLda3yScoPGKgs=; b=akc1mQnfYGfKw+miKCkxPS8bthyonFnsh9xP1fmpBkO1DRRL7KGWwWqeq9ti2D4JSjXD 0OAOkj2WM6oCU5TriPMJy+bjGZdSFl3tP04YBAQ8ACvMvFAjjVBLa3SlyQAowjzqm8Mbn jHIsVS4auEjqB3PQ2ssGtLUSkCqUCZIs55NS1M7j5uqWr7GRtlDpo+GJTuebPjQSNZa1O GLE01iYWEV+ftv7hiscyIIed+6v2bv4/NLXmhRwLedI8Xu5LvDPfhc6l5HJCmTYMpSbnW BXN2SGaHPoNFO8tbD/4qTNXolZwRWIC+GKPN9Oy9jktfO3Wv2P2PF026w5NCEe45dXQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=j3UEfH9J; arc=none smtp.remote-ip=209.85.216.54 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB08D606A322 for ; Thu, 3 Dec 2026 17:52:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BB08D606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=j3UEfH9J Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-3b44bdcea8aso858580a91.1 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=vger.kernel.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=j3UEfH9JIf0r8OW7XsNYPt7GYcXKZMefuWxUXYt9qwkssooX5ZiGPIzYrCt1jQNAln ufjTHr4dYICeiqDH9MW8ynzUr4Cd5Egh2h0xOGMrXsl0BWTrCQZcJ/r36XYdXG1F+3EV y4FymPxpabE4ohzgAj+S7vGUrZKmfCRB6MN5EeFAr2MJAhklAFZpHkBbJOMs2cPiPptH ps8Hex44Brdg9nSzNWCcxX9aBi7Lh2ZvlsEbD0laRD1hxVJEp8qgjutwdZY8Qr2vuQaS tKtlEM+gzXtvlEkmSxpTq7+NuTPrqbPIDIHcVPto+w78BGDpp5AwhLjbyiNRhvyim/Vm 9C4g== 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=TGM7y2jaSZtwube5QZ2lrvUbkoQteBLda3yScoPGKgs=; b=qjKA9e40DAmacNZxFuqcGd5Kd1EdM+3Qc/PJjTdz5qMPXmy8Ce1VzvPp9urgyrsWKH 51n+ZhmF544V9GsgtvAge93QazTUm/EHebjFD/yk9Ph3/J2zysgyQtKtIzydfo69UqsU dfG1izIxqXS80O//V0NvjuIPKo9hrpy8f+eZ70mxXNvJ4y8NtxL4ew1bcqV8vrRowpYW Xq/SbsNPr0JuJgeavejhHbYR09jSx72DQdQoVxSj3bI0POgFjXHzCkcXPwehch1dU8nU MDX0LxTUZUB3o28fDFArMbiaMJSrOKvfEm0LJBvUNsmumKVL6Iyv7UVGybAFMw/TuAOi fozw== X-Forwarded-Encrypted: i=1; AL+hErEgFmOBzbxehhfaIk9YaINba8GcH9xGCfsJhhxYapuEmyUZHoExExDJNiaRNGs3I8hQG1fQezKwW9XFWvs=@vger.kernel.org X-Gm-Message-State: APuU4Z9jOf3zFMNnjFmJcQ1jOLARn4NzedjsXqUuhrMRtp3RdIQ/oNc9 6rY9uMvtCHNF/grDoxUQHJQIMysCxUOCOEGWdju9NuIGUY+tgnWHedEH X-Gm-Gg: AZFdTZcpZlz+kmdA73e/BS5kZObYHR9UdhmrES4PhkidoWy5D9YPcrRrW5OB9fpdM/6 IfdGB0Inh9hvEguk/QVrOUiw0H0nwTdX/Z6nv8FsKtDPMs5zSBwWUNGltL0FWbOWMW+N/OT917J GpM2C5I6HM+wRMXSUP/Lh++k195shrflZFm62x25GFPJwg0rzIKWU1fGx6fK1GvcbSLtpyFpqHv /tv00qmnqTxFS3FLQFvOYQM8doXER9g6XWn3GBpZW0ULr9dYg1XgI5AQ8+lHFA/LCYxE7jmw7ZU ag675bTZ7mT9qvnFG2C+G3xL979fHWYYdZfXGA3obOX53DBOaWKdq/QZo3O+zknUagd0+zLflNm Z6Ki3cYj5CoIhqvqghJALVVsjnKfCVvbvC1uZIhWLHRnCLOA8E1bwV/0pEX3v63jJCjNPFg1WJQ lEkOY7OpQGZDmhPqUHyPBG7Bn+ST+NKm1ZToTQ2l2i6YUuUmyH0QVsxfg0Y3+mrJjzM/P0ju9lQ Un6n8skBDL24tpKlHUb/mxFZ3IM5fAldx++wcnJuSNVHEH1GDPtIpzvTw3EW36/YU1DO3UKZNkO hb3YiGkVP8Qn8URXudS2iPt2UvDe8T48NiXN6UxBSMlIHI1GVg== 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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