From patchwork Thu May 22 06:59:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binbin Zhou X-Patchwork-Id: 892186 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA122221D9B for ; Thu, 22 May 2025 06:59:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747897176; cv=none; b=ZyZqvbDLmyIIRJxZXVzh1Yjag8SiMeixXgCqdfZWzUlzVdyxceSLtjKziIHfBygcCxgbdaL+pflF/67a32wSXPvt4YNWeJQQMgjBpTgl/M5AcOksormfZy2oe9BOGpFdO9S/lAoTSuhe6D4RsZUs+4kM72y/XxLVjJoL/ceUvcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747897176; c=relaxed/simple; bh=eW4ixNaYOCqQsuahvFKD0pjL1C7PfK7aUvCpLdviQR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SP/DxGyjuJBu58SPDRTD+6S7uGDtMac1ysquwXfqETAbXzbvMs/FPuJELdHJ7oLjKpLfqbyOQGM42g0Z8t6CnyQm0FWmfdLl3W+rF3B3vw10d+aSVgps29J+4HnKQjlJ37ydLVM0b+chm2A5ixDTKG7u8ZCs5qwLaYAfB4O/boU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [223.64.69.3]) by gateway (Coremail) with SMTP id _____8BxYa9Uyy5o1CH2AA--.29832S3; Thu, 22 May 2025 14:59:32 +0800 (CST) Received: from localhost.localdomain (unknown [223.64.69.3]) by front1 (Coremail) with SMTP id qMiowMBx3MROyy5otXHnAA--.2109S4; Thu, 22 May 2025 14:59:30 +0800 (CST) From: Binbin Zhou To: Binbin Zhou , Huacai Chen , Ulf Hansson Cc: Huacai Chen , linux-mmc@vger.kernel.org, Binbin Zhou , Aubin Constans , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Subject: [PATCH v2 02/36] mmc: atmel: Use devm_mmc_alloc_host() helper Date: Thu, 22 May 2025 14:59:18 +0800 Message-ID: <78828c43004d591bb3964c80a06e06f02980efc4.1747877176.git.zhoubinbin@loongson.cn> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: qMiowMBx3MROyy5otXHnAA--.2109S4 X-CM-SenderInfo: p2kr3uplqex0o6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBj93XoW7ArW3Jw18tw15AryxWF4xXwc_yoW8XF4xpa y3Wa4jyr4rJF45Wa1DCrZrKFy5XrWaq39FkFW7G34kZr1Utr1jqFnY9Fy7tF13AFy8AF13 Xan8Zr4Uu3WDJFcCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUB0b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1ln4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2 x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5 McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr4 1lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_ Gr1l4IxYO2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI 8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v2 6r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU4Xo7DUUUU Use new function devm_mmc_alloc_host() to simplify the code. Cc: Aubin Constans Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Claudiu Beznea Signed-off-by: Binbin Zhou Reviewed-by: Huacai Chen --- drivers/mmc/host/atmel-mci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 14e981b834b6..f72fe4b805f6 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -2247,7 +2247,7 @@ static int atmci_init_slot(struct atmel_mci *host, struct atmel_mci_slot *slot; int ret; - mmc = mmc_alloc_host(sizeof(struct atmel_mci_slot), dev); + mmc = devm_mmc_alloc_host(dev, sizeof(*slot)); if (!mmc) return -ENOMEM; @@ -2320,10 +2320,8 @@ static int atmci_init_slot(struct atmel_mci *host, host->slot[id] = slot; mmc_regulator_get_supply(mmc); ret = mmc_add_host(mmc); - if (ret) { - mmc_free_host(mmc); + if (ret) return ret; - } if (slot->detect_pin) { timer_setup(&slot->detect_timer, atmci_detect_change, 0); @@ -2361,7 +2359,6 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot, } slot->host->slot[id] = NULL; - mmc_free_host(slot->mmc); } static int atmci_configure_dma(struct atmel_mci *host)