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: 81642 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp720891qge; Thu, 10 Nov 2016 05:23:02 -0800 (PST) X-Received: by 10.99.116.3 with SMTP id p3mr4879255pgc.167.1478784182880; Thu, 10 Nov 2016 05:23:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si4878262pgc.54.2016.11.10.05.23.00; Thu, 10 Nov 2016 05:23:02 -0800 (PST) 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=@nifty.com; 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 S933262AbcKJNW5 (ORCPT + 27 others); Thu, 10 Nov 2016 08:22:57 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:32463 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932336AbcKJNW4 (ORCPT ); Thu, 10 Nov 2016 08:22:56 -0500 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 1.9.1 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;