From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379470; b=jnhLmOF1UICbLOIquJUkCkLpks5BazlPks3jtuirFl4qoj84SnpJ3rwwy+PEb6SDU4MA MU96senskuyZhfelBDZcGdCNhZQ+kWhB7MQB5DuMVwmhRWfK9P//QLG3cPN8g5G2byNMW HYZKkk6eGgUmrwEODc0X041yKdIYTaft2e9Xe8+qXRPjQz6cFtyMt8MRHUZ8mvvi0jDxB IvZOPGm12zIn5V7Zig1QoTr1jBdNdEEahzZReD4eClvkSkNAxqehSkfMdGzkg+/sBYWyU o3wV5hpKZF3n7puvjOvGTiLFbqnVQc9JSlqiqLdlXdA6VIK13hCH4fpRvcwuXsZZHYA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379470; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=QVgBLJLus5RNY2eDpXu/TZuvA9Mvx2j74+zD0Ud4hEw=; b=kML16Q628i6cs0/kVMxdqgyID3DXZJKi9JzLet1IFnwbvN3s4T7FRLweMgt7JIm0pXec sj6HYRbKgqScLWCTOFhzdaGq2skYBXcW++lvQ1XjTAQ9IsM+ddgS+0iwnDBU37MjTImEM MHAzZnDQjKBXTD5nS1cFEZhAKIyxPMltrO1Pkj9lyyFjm6s7iKut4cnzB56HPs4w3lrVa DXXk37KWodZPqEnSDPIMjyw8x4aw6lztktC/5blY4nZdlk3WYnjD0clY2JPIrPxa1R5H9 Zid1ie9t0t8oPH6umCPjV3J0+JzRiHbsfMKUigRAjR0cv6LlHvOu63wjvyJpadpTXEw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nKAdY2A6; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE28B606A322; Fri, 4 Dec 2026 10:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nKAdY2A6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F0EA1F000CE; Fri, 4 Dec 2026 10:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379470; bh=QVgBLJLus5RNY2eDpXu/TZuvA9Mvx2j74+zD0Ud4hEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nKAdY2A6cn0N2lWsEjnlXGQLkx/y9C5cDAKBX1KAdjBbX11J41FcI2dBBp6rYQAQI Z7b0gyOncgQsmFRxakBCNDKM9+DMKFZNv6etTEFZnsosJGcoWnvNhZFw4LD2WtwbxX u9CXTFbqloI2P1A/WaCs7Mox0M0mU9kRiG+42dEM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-sunxi@lists.linux.dev, Huacai Chen , Binbin Zhou , Ulf Hansson , Sasha Levin Subject: [PATCH 6.12 023/555] mmc: sunxi: Use devm_mmc_alloc_host() helper Date: Fri, 4 Dec 2026 19:01:06 +0900 Message-ID: <20261204100605.370033918@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Binbin Zhou [ Upstream commit 5a8af27596118f3e6a121059ac7ac8c299bee164 ] Use new function devm_mmc_alloc_host() to simplify the code. Cc: Chen-Yu Tsai Cc: Jernej Skrabec Cc: Samuel Holland Cc: linux-sunxi@lists.linux.dev Reviewed-by: Huacai Chen Signed-off-by: Binbin Zhou Link: https://lore.kernel.org/r/ee7726b1ea37084258a5d8cec67cad12473152c2.1748933789.git.zhoubinbin@loongson.cn Signed-off-by: Ulf Hansson Stable-dep-of: e35e360bd668 ("mmc: sunxi: fix clock and runtime PM leaks on probe failure") Signed-off-by: Sasha Levin --- drivers/mmc/host/sunxi-mmc.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index e0ab5fd635e6c..cc7c8594a6cac 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1369,11 +1369,10 @@ static int sunxi_mmc_probe(struct platform_device *pdev) struct mmc_host *mmc; int ret; - mmc = mmc_alloc_host(sizeof(struct sunxi_mmc_host), &pdev->dev); - if (!mmc) { - dev_err(&pdev->dev, "mmc alloc host failed\n"); - return -ENOMEM; - } + mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host)); + if (!mmc) + return dev_err_probe(&pdev->dev, -ENOMEM, + "mmc alloc host failed\n"); platform_set_drvdata(pdev, mmc); host = mmc_priv(mmc); @@ -1383,15 +1382,13 @@ static int sunxi_mmc_probe(struct platform_device *pdev) ret = sunxi_mmc_resource_request(host, pdev); if (ret) - goto error_free_host; + return ret; host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); - if (!host->sg_cpu) { - dev_err(&pdev->dev, "Failed to allocate DMA descriptor mem\n"); - ret = -ENOMEM; - goto error_free_host; - } + if (!host->sg_cpu) + return dev_err_probe(&pdev->dev, -ENOMEM, + "Failed to allocate DMA descriptor mem\n"); if (host->cfg->ccu_has_timings_switch) { /* @@ -1481,8 +1478,6 @@ static int sunxi_mmc_probe(struct platform_device *pdev) error_free_dma: dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); -error_free_host: - mmc_free_host(mmc); return ret; } @@ -1498,7 +1493,6 @@ static void sunxi_mmc_remove(struct platform_device *pdev) sunxi_mmc_disable(host); } dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); - mmc_free_host(mmc); } #ifdef CONFIG_PM -- 2.53.0