Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp478763yba; Wed, 3 Apr 2019 12:32:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAN6SqjO+rmsaAHSzkdXyXsB39r2KA4stLR10VaUDkH5pHlb4+eyR4m9cF0U1YQBZn4lPb X-Received: by 2002:a62:5185:: with SMTP id f127mr1216707pfb.199.1554319945354; Wed, 03 Apr 2019 12:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554319945; cv=none; d=google.com; s=arc-20160816; b=LmLDW22iURZ91snvCJ4UhS1fv1RC/8Twncj0vlAeoNTG0nPFQ4moESXrOYt6eClm32 qkMK5BN7jo3bNcy2AgJZOmE3Sc0og4629UwN4kZYcH0JPLMIqFjioZcnC8HJnV2gG5M7 3nsZqz5QrQ7wgZukGWGLZ/nvC6cIalPBldARnPunSJHk+N6kFCl4yt8Z2SX6HtIjTW60 mttTUmh5VJ4CWCqb4ndI1UQBhcce3+RerRHGIPs7bxeaAI6lWLG+c24vVXOQja9KuCJm VWy3xvek++f8UwyEdskYQYaiN5AwDrVLBxFlhs1H2RxN37mOsCkl7U+8E0VM/7Zfi3eN NtNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aZ6nhP8EEvRrGgjeId6P3h0pAV4TUVp+Qlnq4Pegj+s=; b=nvWPR4bpHqA7xJEuTm10chMy+m0tPYN/XpTfnaibDH0lK/797E2Y6+Aeq8Nnoe7Qn/ q1w40aIDbkI69DauR/3i8fff0R3CpySqfkt8U6mry2IZ9g0ywpjOT06h2NRTLYvOduTi 3Ih7pPQu9djFYnzt6pVYMsnCMvr5uJF/8xOt9/IINXsuMR4qkgyj++/L2E1I87MC2SiZ 7afbV3y15yFoMUGDim8gpOduoZyq9KPn1Leilgf3LkZH3kEaTOgBTexUSysG9uVTI2Ox RvdqEzGj0PJdPtGEF79FjR85TgutyA8tFwwu+v3bimWBxTX9kiCxb92DQ4bxbazwEgP1 O/6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=d5QVtuIA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g20si14940209pfg.207.2019.04.03.12.32.07; Wed, 03 Apr 2019 12:32:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=d5QVtuIA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726591AbfDCTbI (ORCPT + 99 others); Wed, 3 Apr 2019 15:31:08 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55945 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfDCTbI (ORCPT ); Wed, 3 Apr 2019 15:31:08 -0400 Received: by mail-wm1-f65.google.com with SMTP id o25so112875wmf.5 for ; Wed, 03 Apr 2019 12:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aZ6nhP8EEvRrGgjeId6P3h0pAV4TUVp+Qlnq4Pegj+s=; b=d5QVtuIA+GDJ3XsaxVBikq5dk0IPw6gI6R2qT4aM0jkXbwsMblfgSxgZmIiECgguzt dHRUS2WrP4RDodZ6+pP4RBAZzt3oICrqrtZPq/57AQJJFAuis2x6DpOJbaH+DdgDE2ye uanm40AccvGVRV03faSGfdwcPwhoo2qWiZCJFN3pEAH9u8hGYIKFW4AkzHpRe1WCTOmq yrfr6AKg5fd04B7/CbOwPcJe3z3ZrtNdm9GOM3wCSmI0mngtBZtyKpeGwpAdPNI3A/ut BQg+vxGzXrP18zFPkeqaSGFfapJhza4eEmg1xzMPfDcmUyfkMdAA2gMRb+GpbkWcDF5s 2+vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aZ6nhP8EEvRrGgjeId6P3h0pAV4TUVp+Qlnq4Pegj+s=; b=StpmL7G0Yi7OJeCWJCNRVzNBwL216/8M0NePyoh14XTPIvEPmWF847NtV9Fh/yAhQF P/6yLYRiuzj1VO1bL7vL5xyi9DaD2MTKLz1EB6VP+/QSA4aASLjjPc+PWM+sWRCkTHC/ m+DElNSvK/ymWTvl4I/OVmeP7Q+Fjjh3y917joSRoYUcNQRWkkVkGf3HNsBbt7JGpf6y PUmQUglasU3a0RkC1HTn0369QenM4ux6S1Gq9OHqvwwh63C285it12tpw7YkUYStC1RE 5MjIHSQBVYBVZbDdviFTj4QZCH2OQb+8E/6JonBiJBGn05oq1XLklkuVVagt2iHd+iKw ie1w== X-Gm-Message-State: APjAAAU5DfDhvjZupna4bFViCvfmVPg4VVzWxhu4tfAhQpDY348hbbnB MHdOMcVSpLN/59cJrjFe38WT0w== X-Received: by 2002:a7b:cb04:: with SMTP id u4mr1302892wmj.0.1554319866395; Wed, 03 Apr 2019 12:31:06 -0700 (PDT) Received: from localhost.localdomain (cag06-8-78-203-165-84.fbx.proxad.net. [78.203.165.84]) by smtp.gmail.com with ESMTPSA id t74sm672463wmt.3.2019.04.03.12.31.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 12:31:05 -0700 (PDT) From: Fabien Parent To: ulf.hansson@linaro.org, matthias.bgg@gmail.com, yingjoe.chen@mediatek.com Cc: chaotian.jing@mediatek.com, ryder.lee@mediatek.com, jjian.zhou@mediatek.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Fabien Parent Subject: [PATCH v2] mmc: mtk-sd: check for valid optional memory resource Date: Wed, 3 Apr 2019 21:30:50 +0200 Message-Id: <20190403193050.22180-1-fparent@baylibre.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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 --- V2: Fix invalid condition: check against 'res' variable instead of 'ret'. --- 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..61bf8704491c 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 (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) -- 2.20.1