From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D8954DDB32; Tue, 13 Oct 2026 12:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895801; cv=none; b=bzYG9XmD1pBnW28P7hJP7qfqFTinF0kSURzFTyAy0nzus2EFauKlMbcr5f1PrZ653Be29/KwLJ+axnmdgk6A4vVZP0JSM9E2hZP7a6EWhJy9orU2sKSGZn1wYfWrBs1wThSkc96bfzf/8Wf6A0vTb3gcP48xcEgkcFOb+b03iys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895801; c=relaxed/simple; bh=aM+2R+QY9ik/0ihcwyI4Ilghsa7DEjn1GCjc3I1dKgs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pm8QMj0UT660/gvuhQJhCUVfwUUeCV2109qiCvtZR4HV+7uRtNJkGy23UUohE3z4o769b1Ay4Amqjdojb415nhGvXM+esvMujfjq81GHVepxAxXqnpDZxdlKLqehlTHeKYedeByQKzyJiMyFTSk+lNHPXJSYeOXPb8WqFuyw/7Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zZObmwVf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zZObmwVf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A03721F00893; Tue, 13 Oct 2026 12:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791895800; bh=2DPtItWPU23IGGKwvxcFbG97MlSiNQFsmjmRl5RlPs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zZObmwVfo2MRQsy1Fzg6vyu6+t9OEn/oBnKc/HGPgbrbe4tfJcnP2sqkj+f+3jVzN Ia6F2paczMT6vm4QikZz2mQolcf4bvO9qgBx1wAYVSIc0GQ//AWvLbelO8RRirfTBl ULdC7+hsd8SAtfTZtlGlmvy5i3lj8eMJskfi07rQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guangshuo Li , Ulf Hansson Subject: [PATCH 6.12 396/497] mmc: cavium-thunderx: destroy slot platform devices on remove Date: Tue, 13 Oct 2026 13:39:23 +0200 Message-ID: <20261013112917.291109817@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guangshuo Li commit 29ee8cf18a21b02cd0b2e35f741b61cd1fe3e14e upstream. thunder_mmc_probe() creates host->slot_pdev[i] with of_platform_device_create(), while thunder_mmc_remove() does not destroy the child platform devices. The probe failure path removes each MMC slot and destroys its associated platform device, but the normal remove path only removes the MMC slot. As a result, the child platform devices remain registered after the ThunderX MMC controller is removed. Destroy each slot platform device during removal after cleaning up the corresponding MMC slot, matching the probe failure cleanup path. Keep an extra device reference around of_platform_device_destroy() as done in the existing error path. This issue was found by manual code inspection. Fixes: 166bac38c3c56 ("mmc: cavium: Add MMC PCI driver for ThunderX SOCs") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/cavium-thunderx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/mmc/host/cavium-thunderx.c +++ b/drivers/mmc/host/cavium-thunderx.c @@ -174,9 +174,12 @@ static void thunder_mmc_remove(struct pc u64 dma_cfg; int i; - for (i = 0; i < CAVIUM_MAX_MMC; i++) + for (i = 0; i < CAVIUM_MAX_MMC; i++) { if (host->slot[i]) cvm_mmc_of_slot_remove(host->slot[i]); + if (host->slot_pdev[i]) + of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL); + } dma_cfg = readq(host->dma_base + MIO_EMM_DMA_CFG(host)); dma_cfg &= ~MIO_EMM_DMA_CFG_EN;