From patchwork Sat Dec 10 18:36:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 32088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1475668wrr; Sat, 10 Dec 2022 12:05:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf4WrqRs/mnqldigHTcDcwBqg2feEyvRL7EQJYuH8DWRSErkT2+3zexOiiXKumlxlYzxQAau X-Received: by 2002:a05:6a20:2aa5:b0:aa:1da0:acf3 with SMTP id v37-20020a056a202aa500b000aa1da0acf3mr16413643pzh.26.1670702739689; Sat, 10 Dec 2022 12:05:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670702739; cv=none; d=google.com; s=arc-20160816; b=K+qQTz1PwN6KD4JizFYRPyJ+/cEIGM0+2J53MZ5squ/0WY/TuYqiX5sNLd0IOGRJRj 9a3Acx3xIBNzH5Q3rxoNrrCbLJi1u50Gc6Vr8OwXXh/NWQnPe9cTgRitZYFuQ+Wvh8Su KRBJaZsBIRyaGrE9TksjdmQ1nLB+BARCDphRW2CsN6NcrEMrrahbFld9ij6jEgDKJXt7 HIW/ckBGFug521tBYy6Qb0vtC+9hwSnvNajYKnYLJu/iDXVTV1cdYzdlY5U6St3WR3Nt 9n/rPQ5r79EO83XI+wRpTvTsCFm9iN5k23SLtOHkTaoRyGfgj42gas5saSGETYiVuD7q EBXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OVhJo0SDQIo+KlAFmCIUbHfuxuxb/QmF9rX8cFtlsM8=; b=fz5TBr2Bz9hjDJZVPj9lRg8VMOdjG4EQbkayJtpc77/1zA5mUWJDbyylXWPiDgdRWY 3IODXuVVMeVMMmLc3p2mO8TLz4EpHchW6Fe8PMFAMAjHDjDnGhaT/lh5Ji8+762XT+vD EbGoo1087MZf6MyWS3+HU9QB6QUh3MJWKL3mBAXIe2XeTVt+diRiwLROS5cnxBAyfbSe o8tIsVzpq/9G99BDXMjoESqnAhtawh0WoojFOo+d0Iy9fz2VhFQ+14Bt/cZBrbb8wXby bGtK6fH59j70FPSf0jdKwIVLelZCDFzODpi5chQiKbfjV+/WL8PQSEp9HaCBh/GFNeLu YSYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm12-20020a17090b3ecc00b00218af09d1f4si5546094pjb.37.2022.12.10.12.05.26; Sat, 10 Dec 2022 12:05:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbiLJSgz (ORCPT + 99 others); Sat, 10 Dec 2022 13:36:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiLJSgv (ORCPT ); Sat, 10 Dec 2022 13:36:51 -0500 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC05A186CA for ; Sat, 10 Dec 2022 10:36:50 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id 44iJpNwaA1SdM44iPpAGvK; Sat, 10 Dec 2022 19:36:49 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 10 Dec 2022 19:36:49 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Tony Huang , Li-hao Kuo , Ulf Hansson Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mmc@vger.kernel.org Subject: [PATCH 3/3] mmc: sunlpus: Slightly simplify the error ahndling path in spmmc_drv_probe() Date: Sat, 10 Dec 2022 19:36:39 +0100 Message-Id: <579d9b5228b67a3fe5bdf305471d98f82c2b311e.1670697358.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <7c686fecb11b4ec1f55cd7075dc7cfcdd9b445ba.1670697358.git.christophe.jaillet@wanadoo.fr> References: <7c686fecb11b4ec1f55cd7075dc7cfcdd9b445ba.1670697358.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751858795765388035?= X-GMAIL-MSGID: =?utf-8?q?1751858795765388035?= If mmc_alloc_host() fails, we can return directly. This saves some LoC, a test and some indentation in the error handling path. Signed-off-by: Christophe JAILLET --- drivers/mmc/host/sunplus-mmc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c index ed789a9bdd23..d990b120789d 100644 --- a/drivers/mmc/host/sunplus-mmc.c +++ b/drivers/mmc/host/sunplus-mmc.c @@ -864,10 +864,8 @@ static int spmmc_drv_probe(struct platform_device *pdev) int ret = 0; mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); - if (!mmc) { - ret = -ENOMEM; - goto probe_free_host; - } + if (!mmc) + return -ENOMEM; host = mmc_priv(mmc); host->mmc = mmc; @@ -936,8 +934,7 @@ static int spmmc_drv_probe(struct platform_device *pdev) return ret; probe_free_host: - if (mmc) - mmc_free_host(mmc); + mmc_free_host(mmc); return ret; }