From patchwork Thu Nov 22 02:20:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10693429 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 9488F14BD for ; Thu, 22 Nov 2018 02:20:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 842422C942 for ; Thu, 22 Nov 2018 02:20:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77B1C2C94D; Thu, 22 Nov 2018 02:20:21 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 0A7332C942 for ; Thu, 22 Nov 2018 02:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732695AbeKVM52 (ORCPT ); Thu, 22 Nov 2018 07:57:28 -0500 Received: from mail-eopbgr150041.outbound.protection.outlook.com ([40.107.15.41]:19328 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730719AbeKVM52 (ORCPT ); Thu, 22 Nov 2018 07:57:28 -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=QMQzq9/mzVRB3OwkJcomzFXh+7gP/0lWqxpc/LJFCQw=; b=CVRsWHuSPwa7kIqlWUXj1QQXSkHr/6PcytjnBFu0BtT6uXh2eD0FDMOmxz4llBHihZ/UDrUTwcxIdqT3/mWjJM952bAIe9xOt24sgtYbzk1xVw6uc91tvU4COMBEueW37xkZdUasXvuDjdr2Xv+YGfOOC128uON2/eCDWkfEQcs= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB5613.eurprd04.prod.outlook.com (20.178.125.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.26; Thu, 22 Nov 2018 02:20:14 +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.016; Thu, 22 Nov 2018 02:20:14 +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 v2] mmc: sdhci-of-esdhc: fix unchecked return value issue Thread-Topic: [PATCH v2] mmc: sdhci-of-esdhc: fix unchecked return value issue Thread-Index: AQHUggnn2ZPAIuKGgk+uODwVJqJcQQ== Date: Thu, 22 Nov 2018 02:20:14 +0000 Message-ID: <1542853562-19018-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: HK2PR02CA0217.apcprd02.prod.outlook.com (2603:1096:201:20::29) 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;VI1PR04MB5613;6:DhryemWNMNfKLp+AopIYe7XBwUx2g0geaSAyBbGX/oGJsDl38+0BuxIIu6pIpHaGWVwZ9eAhrxyOiUeLUjT4Ua6Fg8Lyz/gQZA7IdAuwRt51GcGzEpbn3DUe5FyLlPfK3uYSoDbrhkocrAl9/nGbMHal0S39MrEYUpzisgg0bQgtDDvA/2nAbekEUloXkU70mRefwMmd8W/XMfVNQb9qcMRc4yQb9GuceEg2yRKET8rvHjWPRZ9wZaNFRRLIGUN30EehS/p3loeTkvsKzLhSQilHEwTmDDZMNzexy5l9kEg2jjBvGSeaIIGuGBEAoCZ/juxUtxjFCYKKha8dgRdm2cr3cfQl8k3CgnL/8NsbxEn20+/ijHh7IXdcyG5bqj7zSUGfI95akSyYt5QRB5Y2BvR8Dl6rX0VSg0y1P/z54GlUbI6rtcb1TgxOElvPsZ4B4TT6XXlWltCR+5MTw+f19w==;5:2JHjkiOFrdJ9N6Xc/SvEu80ahk3Et3/Qf8VX7au2HXoakWX9R0sdkp31i/q6KkLwwK2MswSOC/uWyiNUaanxb2XHx97IrO3GWyjuL0CO1VB0xt1o0ctH5xGXPLTosaAgct2m6r1GIApkD037Hfw5mSiSrPoZ50t5Yr9CBKaJ3LY=;7:6cTutamIKTcDkgEEvudJq8TyGsozMvEjp7oobPQ48CbKA+yGKEgwJjKZ81wiUfcopNk//e2NqQCTfnuYaHA2eSZ7zLzjY0EDUEwdhh9yAU3awOvZtcaXldCVz8bG9k3+6hkv1KSIm8aBove6DsxIBQ== x-ms-office365-filtering-correlation-id: bb3676bf-02d6-4afa-26e2-08d65021096a 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:VI1PR04MB5613; x-ms-traffictypediagnostic: VI1PR04MB5613: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231442)(944501410)(52105112)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB5613;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB5613; x-forefront-prvs: 0864A36BBF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(136003)(376002)(346002)(396003)(189003)(199004)(486006)(7736002)(186003)(102836004)(8936002)(476003)(2616005)(4326008)(26005)(2900100001)(66066001)(5660300001)(478600001)(50226002)(6116002)(6486002)(81166006)(81156014)(3846002)(305945005)(14454004)(52116002)(6436002)(2906002)(386003)(6506007)(99286004)(256004)(2501003)(8676002)(110136005)(316002)(14444005)(71190400001)(53936002)(71200400001)(6512007)(86362001)(2201001)(36756003)(25786009)(53346004)(106356001)(105586002)(97736004)(54906003)(68736007);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5613;H:VI1PR04MB5040.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KYHAxQ8KRHsKtRhSQC8zaST7aTeObHEhrW1kGdXCJ+7AMxnUUuRUlAP4np30FALdNEaEUlc/tEgcco/4C0q9hHE53+myHciw7k+H7e6skbHj6ST5n6pInxOtTsEjCzzo3jMGDEZ1m/R3sIX3eYR3CyIQcNPbX629Eywu+eroX0+PvGSJQb/M1L5DwGXjlbR0QMHcX9VmwhSCJ9q19PXYIWFn2IplzHqEZLg0LwLGcVSs3c8iHoI2BKPMhjW4uM48hd8sXXuJlFCTiGsGzYaUs/0romxcVs7dJmijl+aCckmXBT98HHFE+LnMfdGxRBrROcdTS2uNR/xyZmKJlb3OMmcP++SbxoaAgmI/35v2+aw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb3676bf-02d6-4afa-26e2-08d65021096a X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2018 02:20:14.7612 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5613 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. Acked-by: Yangbo Lu Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-of-esdhc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 86fc9f0..51513fd 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -475,11 +475,17 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask) static int esdhc_of_enable_dma(struct sdhci_host *host) { u32 value; + int ret; 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;