From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yingjoe Chen Subject: Re: [PATCH 09/24] mmc: mtk-sd: check for valid optional memory resource Date: Sun, 24 Mar 2019 11:34:26 +0800 Message-ID: <1553398466.26628.0.camel@mtksdaap41> References: <20190323211612.860-1-fparent@baylibre.com> <20190323211612.860-10-fparent@baylibre.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190323211612.860-10-fparent@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org To: Fabien Parent Cc: matthias.bgg@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, ryder.lee@mediatek.com, linux-watchdog@vger.kernel.org, jjian.zhou@mediatek.com, wenzhen.yu@mediatek.com, stephane.leprovost@mediatek.com, sean.wang@kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, yong.mao@mediatek.com, linux-spi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, hsin-hsiung.wang@mediatek.com, linux-serial@vger.kernel.org, linux-clk@vger.kernel.org, chaotian.jing@mediatek.com, linux-i2c@vger.kernel.org List-Id: linux-gpio@vger.kernel.org On Sat, 2019-03-23 at 22:15 +0100, Fabien Parent wrote: > 'top_base' memory region is optional. Check that the resource is valid > before using it. This avoid getting a "invalid resource" error message > printed by the kernel. > > Signed-off-by: Fabien Parent > --- > drivers/mmc/host/mtk-sd.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c > index 833ef0590af8..573aa127d00b 100644 > --- a/drivers/mmc/host/mtk-sd.c > +++ b/drivers/mmc/host/mtk-sd.c > @@ -2123,9 +2123,11 @@ static int msdc_drv_probe(struct platform_device *pdev) > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - host->top_base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(host->top_base)) > - host->top_base = NULL; > + if (ret) { This should be res? > + host->top_base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(host->top_base)) > + host->top_base = NULL; > + } > > ret = mmc_regulator_get_supply(mmc); > if (ret) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADED0C43381 for ; Sun, 24 Mar 2019 03:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D2052171F for ; Sun, 24 Mar 2019 03:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728117AbfCXDes (ORCPT ); Sat, 23 Mar 2019 23:34:48 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:1799 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727706AbfCXDer (ORCPT ); Sat, 23 Mar 2019 23:34:47 -0400 X-UUID: 4139318f1e5040d8bdad11c93286e163-20190324 X-UUID: 4139318f1e5040d8bdad11c93286e163-20190324 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1396306676; Sun, 24 Mar 2019 11:34:29 +0800 Received: from MTKMBS01DR.mediatek.inc (172.21.101.111) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 24 Mar 2019 11:34:27 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01dr.mediatek.inc (172.21.101.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 24 Mar 2019 11:34:26 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 24 Mar 2019 11:34:26 +0800 Message-ID: <1553398466.26628.0.camel@mtksdaap41> Subject: Re: [PATCH 09/24] mmc: mtk-sd: check for valid optional memory resource From: Yingjoe Chen To: Fabien Parent CC: , , , , , , , , , , , , , , , , , , , , , Date: Sun, 24 Mar 2019 11:34:26 +0800 In-Reply-To: <20190323211612.860-10-fparent@baylibre.com> References: <20190323211612.860-1-fparent@baylibre.com> <20190323211612.860-10-fparent@baylibre.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N X-TM-SNTS-SMTP: 054869C2B2FF6DCD1AFCF49E6578D95B61694A9C9726265AD53ECF398AE763E82000:8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2019-03-23 at 22:15 +0100, Fabien Parent wrote: > 'top_base' memory region is optional. Check that the resource is valid > before using it. This avoid getting a "invalid resource" error message > printed by the kernel. > > Signed-off-by: Fabien Parent > --- > drivers/mmc/host/mtk-sd.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c > index 833ef0590af8..573aa127d00b 100644 > --- a/drivers/mmc/host/mtk-sd.c > +++ b/drivers/mmc/host/mtk-sd.c > @@ -2123,9 +2123,11 @@ static int msdc_drv_probe(struct platform_device *pdev) > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - host->top_base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(host->top_base)) > - host->top_base = NULL; > + if (ret) { This should be res? > + host->top_base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(host->top_base)) > + host->top_base = NULL; > + } > > ret = mmc_regulator_get_supply(mmc); > if (ret) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 949B2C43381 for ; Sun, 24 Mar 2019 03:35:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5038C2171F for ; Sun, 24 Mar 2019 03:35:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tKjcMy+5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5038C2171F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HOpLcRtqAeAblvxN70B25bXECxHKcJ1vPo7EeESCYLU=; b=tKjcMy+5ZCr7tE JXS9EmjTOwNwf4sLUMCXsosmjqql2O7yt4hKgX9hFRxN5fG9JIxlBee0Ju87pkaysmtCOO6MOXuzG HL043PxsfqRtsYJ1ByC4UDVKs4bKGcClKcwBauzIWoNe+9hPPDIgQebNNQGH+AIh/itaFJSJf05O9 +nNp2px6zF6x3r6PqghRzdDhWaLWHmfDgZ/V0wQxnagyAm73bOL0gcipPkuI9BrqC1K7gIkTDYUIE N323/PIR1/RKvKL088QX9PayIw8DXjMIadttoTBZrhnX/43BfbA7/cjFYMTXlxYwnxjpnNcUG+FS1 yhs7b11Goy/rIAiqCoyQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7tuT-0002U6-Mu; Sun, 24 Mar 2019 03:34:57 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7tuK-0002SV-Ee; Sun, 24 Mar 2019 03:34:55 +0000 X-UUID: f908f4776b914f76b0e4f006d917df74-20190323 X-UUID: f908f4776b914f76b0e4f006d917df74-20190323 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1682081050; Sat, 23 Mar 2019 19:34:41 -0800 Received: from MTKMBS01DR.mediatek.inc (172.21.101.111) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 23 Mar 2019 20:34:40 -0700 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01dr.mediatek.inc (172.21.101.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 24 Mar 2019 11:34:26 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 24 Mar 2019 11:34:26 +0800 Message-ID: <1553398466.26628.0.camel@mtksdaap41> Subject: Re: [PATCH 09/24] mmc: mtk-sd: check for valid optional memory resource From: Yingjoe Chen To: Fabien Parent Date: Sun, 24 Mar 2019 11:34:26 +0800 In-Reply-To: <20190323211612.860-10-fparent@baylibre.com> References: <20190323211612.860-1-fparent@baylibre.com> <20190323211612.860-10-fparent@baylibre.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190323_203448_495985_802EB227 X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, wenzhen.yu@mediatek.com, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, hsin-hsiung.wang@mediatek.com, ryder.lee@mediatek.com, jjian.zhou@mediatek.com, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, stephane.leprovost@mediatek.com, linux-gpio@vger.kernel.org, robh+dt@kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, chaotian.jing@mediatek.com, linux-arm-kernel@lists.infradead.org, sean.wang@kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, yong.mao@mediatek.com, linux-spi@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 2019-03-23 at 22:15 +0100, Fabien Parent wrote: > 'top_base' memory region is optional. Check that the resource is valid > before using it. This avoid getting a "invalid resource" error message > printed by the kernel. > > Signed-off-by: Fabien Parent > --- > drivers/mmc/host/mtk-sd.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c > index 833ef0590af8..573aa127d00b 100644 > --- a/drivers/mmc/host/mtk-sd.c > +++ b/drivers/mmc/host/mtk-sd.c > @@ -2123,9 +2123,11 @@ static int msdc_drv_probe(struct platform_device *pdev) > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - host->top_base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(host->top_base)) > - host->top_base = NULL; > + if (ret) { This should be res? > + host->top_base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(host->top_base)) > + host->top_base = NULL; > + } > > ret = mmc_regulator_get_supply(mmc); > if (ret) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel