From patchwork Sat Dec 10 18:36:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 32084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1450050wrr; Sat, 10 Dec 2022 10:38:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7xvRPR5fBJbnOUv6tYqByb3JxBNMoPM0mmJ4gC26JJOiPSQXQVciuozKzJfyWVl0abFVvq X-Received: by 2002:a17:907:cf48:b0:7aa:ee98:b812 with SMTP id uv8-20020a170907cf4800b007aaee98b812mr2501624ejc.19.1670697531715; Sat, 10 Dec 2022 10:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670697531; cv=none; d=google.com; s=arc-20160816; b=xDq3e++HDIY4JJfUaXU1edLM83AH+sugfuLNHGM+xb/bgZLHBZ3UUQemDtXIfQFe69 cKh/OL5iqWmGncm7rwJFXDoSxqrN9sr/qH24wUxM6HYhusSbfmvwcsxkam5KwFUdTJ3W 8Q4QAcAAh9Oe5OoVBBrRGb1y8eRKw7nlcfGrWhD6UF8325VLRbquEcZn+l2/iAE4A32V 64pequ0sPC6MYSk8uP3ixPRilm+hnSG8bmP8woQkTHVo24CPeS9ulBlg/nRNd5e8YsNG wPabTon7BWqtQqIE4gyAzszeAMnkN7ZzpX7+7uNWBvh1tJYcgobJZaHP0wM+84AN0Wy+ zE5A== 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 :message-id:date:subject:cc:to:from; bh=z0h36/dLu6KUKERRu/XRRrIt/BaGU+EWwOVcIjPDcy8=; b=WvXZVChhYHpu8gEwkZr1r1xgFtWPJpSpiJ5lyVqLSJkOoDsMBszc+swOScp0dXD0wJ G5N3mIvPqm/rBjBtRMQn8ULA6Z0XqUbjyCFeD+6Y2Djj/dRBkSdN7fulLQlJaQhctVF7 fxzAnF5okLD6NkgXYe7xobbqEc1WGw46CroFmdMScMRJp+NnW84zj53nkhoKeBmcnxtD A+x+B3qLAywM26+C0hkE+Y0pe40Am/bC/zJODTJ0dpchnbSfNQyWwzJYTu9EI+RrSk+6 leEXdJhC62H0lEifbcDPqt3vJmdEmPFEhPcrgyxvWUMJxCBeLYJm34QBuj8cTBMDN+iJ /vrQ== 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 gb31-20020a170907961f00b0078e063fc787si3063182ejc.433.2022.12.10.10.38.28; Sat, 10 Dec 2022 10:38:51 -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 S229628AbiLJSgt (ORCPT + 99 others); Sat, 10 Dec 2022 13:36:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiLJSgr (ORCPT ); Sat, 10 Dec 2022 13:36:47 -0500 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB3417412 for ; Sat, 10 Dec 2022 10:36:46 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id 44iJpNwaA1SdM44iJpAGuk; Sat, 10 Dec 2022 19:36:44 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 10 Dec 2022 19:36:44 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Tony Huang , Li-hao Kuo , Ulf Hansson , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mmc@vger.kernel.org Subject: [PATCH 1/3] mmc: sunlpus: Fix an error handling path in spmmc_drv_probe() Date: Sat, 10 Dec 2022 19:36:37 +0100 Message-Id: <7c686fecb11b4ec1f55cd7075dc7cfcdd9b445ba.1670697358.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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?1751853334797682829?= X-GMAIL-MSGID: =?utf-8?q?1751853334797682829?= If an error occurs after successful clk_prepare_enable() call in the probe, the clk is not clk_disable_unprepare()'ed. Use devm_clk_get_enabled() instead of devm_clk_get() to fix, and simplify the probe and the remove function accordingly. Fixes: 4e268fed8b18 ("mmc: Add mmc driver for Sunplus SP7021") Signed-off-by: Christophe JAILLET --- This changes the order of resource releasing when the driver is removed, but it looks ok to me. --- drivers/mmc/host/sunplus-mmc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c index db5e0dcdfa7f..3e8856a82188 100644 --- a/drivers/mmc/host/sunplus-mmc.c +++ b/drivers/mmc/host/sunplus-mmc.c @@ -878,7 +878,7 @@ static int spmmc_drv_probe(struct platform_device *pdev) if (IS_ERR(host->base)) return PTR_ERR(host->base); - host->clk = devm_clk_get(&pdev->dev, NULL); + host->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(host->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(host->clk), "clk get fail\n"); @@ -896,10 +896,6 @@ static int spmmc_drv_probe(struct platform_device *pdev) if (ret) return ret; - ret = clk_prepare_enable(host->clk); - if (ret) - return dev_err_probe(&pdev->dev, ret, "failed to enable clk\n"); - ret = mmc_of_parse(mmc); if (ret) goto probe_free_host; @@ -944,7 +940,6 @@ static int spmmc_drv_remove(struct platform_device *dev) mmc_remove_host(host->mmc); pm_runtime_get_sync(&dev->dev); - clk_disable_unprepare(host->clk); pm_runtime_put_noidle(&dev->dev); pm_runtime_disable(&dev->dev); platform_set_drvdata(dev, NULL); From patchwork Sat Dec 10 18:36:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 32083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1449949wrr; Sat, 10 Dec 2022 10:38:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ZKqCqM2P2c57AkO9k49gfTSm4SCZZFYSWCNTyd6bXjk+t+3A5vi/D/ly3y17VcQuO8KSR X-Received: by 2002:a17:906:b810:b0:7c1:5467:39b1 with SMTP id dv16-20020a170906b81000b007c1546739b1mr1820852ejb.72.1670697507968; Sat, 10 Dec 2022 10:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670697507; cv=none; d=google.com; s=arc-20160816; b=QLnVuT7UAa+OKeNw7gF1S1ut908Y8mIi7bwXjxMXVdZv38PiSlpxfwtiN+wfDvhYRY AjtXqsSuLURlPhksOurrOEOfi4qEPDTsmmWfiKLASMXYZM+dj2YX+og3PkF2XaG7VHSs 16fpoEJENJ8cMqwEucUJOcMp7CtJNHCZBk7eyPuc4PFMjKTlcsnQFi7RE7iG5QSWVZJW DM9qtHLbkE0/veccLpvqn3EeMWL+WH9gxljPPyh1mB982WbgatyK17Tf4+iPG34x5tcZ uk9Sz6gH/JkuoWWoGmZS+Oq3aO8x4H8TF/dzawFltBFYLgdBMF+lKqKDHEh1V6a1isbl MKiQ== 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=19pxnp+2cXMQQvka+JPJKBmniYU7WKohLMhTqwMajGk=; b=QG62ZVh62ipkoP4mOXkJXUIKbWh5htLIoklMDLxp6pgfSq7WucYl5ZjdR8KPcKZiZ+ wqqGq7jm1mt/VhPhqv+J+wwbTtbEYHBMmgmSRSX/CSaHZ3VCI38FXhHWNVoOVyUeRBA5 NzOKicRL61htKIlb8aIeLOR0NY8D4+8u5oQmes3JstARriydkaItzDH74gW2dtNspzsM AftTiMP8dHMRUVdL9usCZ9yxDuhzq7ftyXmz3a9C5RIgbSwLq0BGZsaEXypGT87zIBny LxJvnKy6i4mMS+Pv6VZRII7z5FSisj+l8xc1P+jSLBx2opMhL+LoR4rex1SJgTa+vpiN xrow== 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 lf3-20020a170907174300b007316ac034acsi2197903ejc.834.2022.12.10.10.38.05; Sat, 10 Dec 2022 10:38:27 -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 S229750AbiLJSgv (ORCPT + 99 others); Sat, 10 Dec 2022 13:36:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbiLJSgt (ORCPT ); Sat, 10 Dec 2022 13:36:49 -0500 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213C913DE1 for ; Sat, 10 Dec 2022 10:36:49 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id 44iJpNwaA1SdM44iNpAGvA; Sat, 10 Dec 2022 19:36:47 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 10 Dec 2022 19:36:47 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Tony Huang , Li-hao Kuo , Ulf Hansson , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mmc@vger.kernel.org Subject: [PATCH 2/3] mmc: sunlpus: Fix a memory leak in case of error in spmmc_drv_probe() Date: Sat, 10 Dec 2022 19:36:38 +0100 Message-Id: <9c52251e1ba837ca204e253627679f1e42ebe9fa.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, RCVD_IN_MSPIKE_H2,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?1751853309993796881?= X-GMAIL-MSGID: =?utf-8?q?1751853309993796881?= If an error occurs after a successful mmc_alloc_host() call in the probe, the error handling path should be executed in order to call mmc_free_host(). Fixes: 4e268fed8b18 ("mmc: Add mmc driver for Sunplus SP7021") Signed-off-by: Christophe JAILLET --- drivers/mmc/host/sunplus-mmc.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c index 3e8856a82188..ed789a9bdd23 100644 --- a/drivers/mmc/host/sunplus-mmc.c +++ b/drivers/mmc/host/sunplus-mmc.c @@ -875,26 +875,34 @@ static int spmmc_drv_probe(struct platform_device *pdev) host->dma_int_threshold = 1024; host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(host->base)) - return PTR_ERR(host->base); + if (IS_ERR(host->base)) { + ret = PTR_ERR(host->base); + goto probe_free_host; + } host->clk = devm_clk_get_enabled(&pdev->dev, NULL); - if (IS_ERR(host->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(host->clk), "clk get fail\n"); + if (IS_ERR(host->clk)) { + ret = dev_err_probe(&pdev->dev, PTR_ERR(host->clk), "clk get fail\n"); + goto probe_free_host; + } host->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); - if (IS_ERR(host->rstc)) - return dev_err_probe(&pdev->dev, PTR_ERR(host->rstc), "rst get fail\n"); + if (IS_ERR(host->rstc)) { + ret = dev_err_probe(&pdev->dev, PTR_ERR(host->rstc), "rst get fail\n"); + goto probe_free_host; + } host->irq = platform_get_irq(pdev, 0); - if (host->irq <= 0) - return host->irq; + if (host->irq <= 0) { + ret = host->irq; + goto probe_free_host; + } ret = devm_request_threaded_irq(&pdev->dev, host->irq, spmmc_irq, spmmc_func_finish_req, IRQF_SHARED, NULL, host); if (ret) - return ret; + goto probe_free_host; ret = mmc_of_parse(mmc); if (ret) 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; }