From patchwork Thu Nov 10 13:24:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9421055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B449F601C0 for ; Thu, 10 Nov 2016 13:25:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7B5429724 for ; Thu, 10 Nov 2016 13:25:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C1E729727; Thu, 10 Nov 2016 13:25:28 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1E83829724 for ; Thu, 10 Nov 2016 13:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932336AbcKJNZ1 (ORCPT ); Thu, 10 Nov 2016 08:25:27 -0500 Received: from condef003-v.nifty.com ([210.131.4.240]:41586 "EHLO condef003-v.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932820AbcKJNZ0 (ORCPT ); Thu, 10 Nov 2016 08:25:26 -0500 Received: from conuserg-07.nifty.com ([10.26.8.70])by condef003-v.nifty.com with ESMTP id uAADMvO9018334 for ; Thu, 10 Nov 2016 22:22:57 +0900 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id uAADLla2010488; Thu, 10 Nov 2016 22:22:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com uAADLla2010488 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1478784135; bh=3sd947HoFxdE/2vmBfWyDsfV+yYnWBJFnIreC4gNGyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QXcM9zC0KAXmF7V/fu1BAuAmoOLVhloYY9gf/9ZSrnDAMBgJlv06M7jj3dqsiy2rM G52EOSydvMddlfFbzna+ZnryFWSF5SgJWufvPOnF/0DXWMk5lcsYQCv/uOtnehRvYj 83wRR8iWw5QvFfzHAOy/+UHmqvQxpz6Wf/13RPab0sZi3p3xRjKD7s1GbdBOOPUCNr kEWiLLI8HcedJ6pQmdpWPAXn8+hZg4jAcBLoBGT7v+CnXAsCJqBONqL8DguLneMrZY 0npNZggKqQA7mAaOEGqv4aRV8Yw2+NUWpPm20mIWMxHiI7YlUJvhSgEzrtCV84gEtb NeO0t/0nDVL8w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Wolfram Sang , Ulf Hansson Subject: [PATCH 2/2] mmc: tmio: allow tmio_mmc_host_alloc() to return proper error code Date: Thu, 10 Nov 2016 22:24:23 +0900 Message-Id: <1478784263-18777-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1478784263-18777-1-git-send-email-yamada.masahiro@socionext.com> References: <1478784263-18777-1-git-send-email-yamada.masahiro@socionext.com> 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 Now, mmc_alloc_host() returns an error pointer when it fails. So, tmio_mmc_host_alloc() can also return an error pointer to propagate the proper error code. Signed-off-by: Masahiro Yamada --- drivers/mmc/host/sh_mobile_sdhi.c | 4 ++-- drivers/mmc/host/tmio_mmc.c | 4 +++- drivers/mmc/host/tmio_mmc_pio.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 49edff7..97a796c 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -355,8 +355,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) } host = tmio_mmc_host_alloc(pdev); - if (!host) { - ret = -ENOMEM; + if (IS_ERR(host)) { + ret = PTR_ERR(host); goto eprobe; } diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index e897e7f..3316545 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -93,8 +93,10 @@ static int tmio_mmc_probe(struct platform_device *pdev) pdata->flags |= TMIO_MMC_HAVE_HIGH_REG; host = tmio_mmc_host_alloc(pdev); - if (!host) + if (IS_ERR(host)) { + ret = PTR_ERR(host); goto cell_disable; + } /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ host->bus_shift = resource_size(res) >> 10; diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index 18106fc..7e8c80e 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -1014,7 +1014,7 @@ struct tmio_mmc_host* mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev); if (IS_ERR(mmc)) - return NULL; + return ERR_CAST(mmc); host = mmc_priv(mmc); host->mmc = mmc;