From patchwork Wed Nov 21 08:20:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10692109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0480213AD for ; Wed, 21 Nov 2018 08:21:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E38DD2B8D4 for ; Wed, 21 Nov 2018 08:21:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D75A62B8E0; Wed, 21 Nov 2018 08:21:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAB182B8D4 for ; Wed, 21 Nov 2018 08:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbeKUSyg (ORCPT ); Wed, 21 Nov 2018 13:54:36 -0500 Received: from mail-eopbgr40070.outbound.protection.outlook.com ([40.107.4.70]:5584 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726195AbeKUSyg (ORCPT ); Wed, 21 Nov 2018 13:54:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kwkkLPUr3LRWg3TZF/DHCNvGddM+9nyc1CNkNc1ma5Y=; b=S+ami7u2vfP0xAWlMyaWcGvYODXtIrnobXusrkrA2i2UTnbkkNjc6PSZBwFfUh4CXWhlAJQ04hF8C1pMFuvItkqZC5DKJGBY+pVxEWDWFkiyM8MMDrhlTSIph6fOioiFE48EH2dLaVZrivdNMyVER408FIHJ2r8NOHFxxxRE0ws= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB5085.eurprd04.prod.outlook.com (20.177.50.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.15; Wed, 21 Nov 2018 08:20:59 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c11f:8a71:720d:4201]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c11f:8a71:720d:4201%2]) with mapi id 15.20.1361.013; Wed, 21 Nov 2018 08:20:59 +0000 From: BOUGH CHEN To: "adrian.hunter@intel.com" , "ulf.hansson@linaro.org" , "linux-mmc@vger.kernel.org" CC: "Y.B. LU" , dl-linux-imx , BOUGH CHEN Subject: [PATCH] mmc: sdhci-of-esdhc: fix unchecked return value issue Thread-Topic: [PATCH] mmc: sdhci-of-esdhc: fix unchecked return value issue Thread-Index: AQHUgXMhYCUvKNX30UWZWddHyCH4Rw== Date: Wed, 21 Nov 2018 08:20:59 +0000 Message-ID: <1542788904-15621-1-git-send-email-haibo.chen@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 1.9.1 x-clientproxiedby: HK0PR03CA0096.apcprd03.prod.outlook.com (2603:1096:203:72::36) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:59::33) authentication-results: spf=none (sender IP is ) smtp.mailfrom=haibo.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.121.68.129] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB5085;6:78zbXMTqYCs/Yx932npodgYY4SJhBHawf4hrvFAy2BN05x7fzcdT7DPAwISjvnINa8AXmqp3mVdXthYJ/xkZ/iTw++P/dzbQIae6UxDkolLry6t7fc/Qo02R1JrD58rnJPZANr58VE98zy8OvzVKH0NieKYu5InD/MubpAY47mGBABVNZW28F996P9byP40MuDxPlD5vFVNNQrzU1E7MaferWZUJrm5raBCwiDlmEBDxSrhhBjktY5sEolusvOmOKD0p0kYspJ5WynLghKfUtcIzB9KZU1LgBc2YPiDXO6gOGSXaOn4PGOPeeg6L8BpG2rxALXmCCElrVFNmERPwLGLILE4h44DdgeCtGbwmgosV7o8P/l01pqFfAztQ4XEPJwy9seVxzF42NctCdG/+aNeedIwsDuT4XT5auehGt+m/J3JnTDI7bE7dojnyZ/BCPblglB8vvcGuR14TApzroQ==;5:KOcpEaogl5PayZRrl6XA9BUJHsANDAGEQJTr2Fw92yA3quhAlsJX7bdOcxEm55W7zCTWZfcffjEFZ4UuOHtIynaJspjaxnL2+6Oge9yv3ZjGF5BPPMvjcqgrV/AXV+R2DZVppFgUQa//I5D2Ervt2ESxUGYdjuomeCbQguoVWRo=;7:eZsUFKIBcsxP7clndjvIKZS0Kliuv9dNOaARlVsyhPbyhKN4UUB9zFrVK6n4JF0m/5J8r2J6OhKOrpqVZgOXyMR5U6F54KLVHN1qJlWye5Iovaa58n33NQrMAb50r0uzNuRd02EqDVXCR/pGB+MAag== x-ms-office365-filtering-correlation-id: 92adfe33-e982-419b-1fc9-08d64f8a441a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5085; x-ms-traffictypediagnostic: VI1PR04MB5085: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231442)(944501410)(52105112)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB5085;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB5085; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(376002)(396003)(366004)(199004)(189003)(68736007)(6436002)(6486002)(316002)(97736004)(186003)(8936002)(110136005)(478600001)(54906003)(7736002)(1857600001)(305945005)(5660300001)(2900100001)(8676002)(99286004)(106356001)(36756003)(102836004)(26005)(25786009)(4326008)(52116002)(105586002)(81166006)(6506007)(81156014)(486006)(66066001)(2616005)(476003)(2201001)(86362001)(386003)(3846002)(14454004)(53346004)(50226002)(53936002)(6116002)(256004)(2906002)(2501003)(71200400001)(14444005)(6512007)(71190400001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5085;H:VI1PR04MB5040.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: PQILbbTJ/LpG2Ock8t3CnpunaczMNjDYTO++pFPdrgwROQzAlJaO3baMGP9i6IcM61OmRLZsy46lHukAeaGXxMJB+tET65m0wP0Fe9VN037Z/prt1GT3NjdIXCj2lMaKu+shUiaL+4jOcWakQcaYK3OWYRA3vNyk3iWwh1Ycvx8pGcGwMmtIKGi/FX2s7x086YpNgNgIKlG+M397IXq1SFONuM9Pgfe9XuFKqsiy093OIs0jo4YFucGmmO+UAHgw6OPmnnctkui5i6PmkBqeFBeOq1QpuIQsXyIL9kB6chZs9q90PFBxjeKzHyMAk5IDYLY16uKvX3h9NX9s9IZp3KmKufoDE4NlWSpyfuUZ2RU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92adfe33-e982-419b-1fc9-08d64f8a441a X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 08:20:59.1741 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5085 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Calling dma_set_mask_and_coherent without checking return value. This was caught by coverity scan. Fix this by check the return value, and give a warning if get a false. Signed-off-by: Haibo Chen Acked-by: Yangbo Lu --- drivers/mmc/host/sdhci-of-esdhc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 86fc9f0..bfba630 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -478,8 +478,13 @@ static int esdhc_of_enable_dma(struct sdhci_host *host) struct device *dev = mmc_dev(host->mmc); if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") || - of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); + of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) { + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); + if (ret) { + pr_warn("%s: Failed to set 40-bit DMA mask.\n", + mmc_hostname(host->mmc)); + } + } value = sdhci_readl(host, ESDHC_DMA_SYSCTL); value |= ESDHC_DMA_SNOOP;