From patchwork Mon Apr 13 14:07:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 6209751 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 086379F1C4 for ; Mon, 13 Apr 2015 14:08:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D74EA2034B for ; Mon, 13 Apr 2015 14:08:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B178202EB for ; Mon, 13 Apr 2015 14:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754039AbbDMOIL (ORCPT ); Mon, 13 Apr 2015 10:08:11 -0400 Received: from bhuna.collabora.co.uk ([93.93.135.160]:33461 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753708AbbDMOIL (ORCPT ); Mon, 13 Apr 2015 10:08:11 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id 23776600EFC From: Javier Martinez Canillas To: Ulf Hansson Cc: Alexandre Courbot , Marek Szyprowski , Olof Johansson , Doug Anderson , Kevin Hilman , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Javier Martinez Canillas Subject: [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc() Date: Mon, 13 Apr 2015 16:07:41 +0200 Message-Id: <1428934061-29217-1-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.4 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the struct mmc_pwrseq_match .alloc function used to allocate a struct mmc_pwrseq fails, the error is propagated to mmc_of_parse(). But instead of returning the error code in pwrseq, host->pwrseq is returned which will always be 0. So mmc_of_parse() succeeds even if the pwrseq .alloc function failed and host->pwrseq is NULL. This makes the SDIO device to not be powered if the power sequencing .alloc functions wants to be deferred due a missing resource because the mmc controller driver probe did wrongly succeed. Fixes: 0f12a0ce4ce4a ("mmc: pwrseq: simplify alloc/free hooks") Signed-off-by: Javier Martinez Canillas Reviewed-by: Alexandre Courbot --- drivers/mmc/core/pwrseq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c index ab2129781161..4c1d1757dbf9 100644 --- a/drivers/mmc/core/pwrseq.c +++ b/drivers/mmc/core/pwrseq.c @@ -73,7 +73,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host) pwrseq = match->alloc(host, &pdev->dev); if (IS_ERR(pwrseq)) { - ret = PTR_ERR(host->pwrseq); + ret = PTR_ERR(pwrseq); goto err; }