From patchwork Thu Dec 18 09:41:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5512171 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B694ABEEBA for ; Thu, 18 Dec 2014 09:42:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E76BA20A22 for ; Thu, 18 Dec 2014 09:42:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99BD820A1B for ; Thu, 18 Dec 2014 09:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751842AbaLRJmI (ORCPT ); Thu, 18 Dec 2014 04:42:08 -0500 Received: from mail-wi0-f176.google.com ([209.85.212.176]:64703 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564AbaLRJmH (ORCPT ); Thu, 18 Dec 2014 04:42:07 -0500 Received: by mail-wi0-f176.google.com with SMTP id ex7so1092769wid.15 for ; Thu, 18 Dec 2014 01:42:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=UP/HXYqbaP7+LKz/95/05oPn4LIhHpTp+O8XL5u/lgE=; b=i82WU5t7y2RAoy14DYA894isUub/x2nfdcXPv23nh+Pm80tf4eVTgB5i6qOMIZwPuo rht9pHjF7J9UVVGbwpMyiIsmqy+OH9KUbujzhX0tuRuUYNiWoXUG9RwkAB0c4XWSk/VT s5Gi210JPPJAzMXmlcIurMhcrJsJhUMCtDG7FaTKIKa5Lo+pZn1QMCOg7wIB9bSjuBaQ LXfXOmT2LWZxqw9BgdirzZJb7++DdpeU1QMLaTvJYC+EJyWYeGOdV4x7Ex0YyImj0Y+1 eF//Dy6YLL37YTaKuJEblK/5PvskLVwb24zqhtEKneU/l+Bcud242B1aytu4KBo9tc/y FO7w== X-Gm-Message-State: ALoCoQnZXC7wz7FZkyEnyLH5C9DWBQ+nlUhXzrXytB2IPTXUQHBHpLZPItfta2MdvhyVoGCRVQT+ X-Received: by 10.180.208.69 with SMTP id mc5mr23036936wic.25.1418895724404; Thu, 18 Dec 2014 01:42:04 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id w10sm8256264wje.10.2014.12.18.01.42.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Dec 2014 01:42:03 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Subject: [PATCH 6/6] mmc: core: Return error at failure of request CD/WP in mmc_of_parse() Date: Thu, 18 Dec 2014 10:41:44 +0100 Message-Id: <1418895704-25908-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418895704-25908-1-git-send-email-ulf.hansson@linaro.org> References: <1418895704-25908-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@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=ham 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 Instead of just printing an error when mmc_of_parse() fails to request CD/WP GPIO pins, let's propagate all errors, except for -ENOENT. Earlier only -EPROBE_DEFER was handled correctly. As a side effect of this change and by relying on host drivers to handle the errors during ->probe(), we don't need to free any data in the error path. This also means we are actually fixing a bug, since we remove the call to mmc_gpio_free_cd() which wasn't the correct function to invoke to handle cleanup. Instead that should have been mmc_gpiod_free_cd(). Signed-off-by: Ulf Hansson --- drivers/mmc/core/host.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 270d58a..45c2dae 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -367,16 +367,10 @@ int mmc_of_parse(struct mmc_host *host) ret = mmc_gpiod_request_cd(host, "cd", 0, true, 0, &cd_gpio_invert); - if (ret) { - if (ret == -EPROBE_DEFER) - return ret; - if (ret != -ENOENT) { - dev_err(host->parent, - "Failed to request CD GPIO: %d\n", - ret); - } - } else + if (!ret) dev_info(host->parent, "Got CD GPIO\n"); + else if (ret != -ENOENT) + return ret; /* * There are two ways to flag that the CD line is inverted: @@ -397,16 +391,10 @@ int mmc_of_parse(struct mmc_host *host) ro_cap_invert = of_property_read_bool(np, "wp-inverted"); ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); - if (ret) { - if (ret == -EPROBE_DEFER) - goto out; - if (ret != -ENOENT) { - dev_err(host->parent, - "Failed to request WP GPIO: %d\n", - ret); - } - } else + if (!ret) dev_info(host->parent, "Got WP GPIO\n"); + else if (ret != -ENOENT) + return ret; /* See the comment on CD inversion above */ if (ro_cap_invert ^ ro_gpio_invert) @@ -458,10 +446,6 @@ int mmc_of_parse(struct mmc_host *host) } return 0; - -out: - mmc_gpio_free_cd(host); - return ret; } EXPORT_SYMBOL(mmc_of_parse);