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: 42412 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF5E826C6B for ; Thu, 18 Dec 2014 09:42:20 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf614562eek.0 for ; Thu, 18 Dec 2014 01:42:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=UP/HXYqbaP7+LKz/95/05oPn4LIhHpTp+O8XL5u/lgE=; b=EdIH7BkKlRosf8u2jC0lBxRXZZuOdhEBksdw8DBcFwubV753wRAtbPw1oN67H+kKU+ N5FjRlHcKD+qcD/g5TkoT8IUkMJfDcI04cm7IU/WByJWZXOR0Soaj4j+oLywDiD5nWNW 6ySY93NUTorNRFaWNFc2Fe0x/zA+9yas1gAwYHsTgtIXPI86K8SNbyhQ1Wd/9IVCtRCL jz7RcYhEeuvWz/6SggLfSUMd/zRM9YAYmmXc3NoOO4drLry1JeZ+9vWNNC4IJxfqvk6B dVd3eBtUci4MUPPzCSEgcUUJW6PkxucazJRZAoEHdAQ4ftdGW/d1D9sShi3M9AN7TLJ8 i7cQ== X-Gm-Message-State: ALoCoQkupUts+nySD3TrwuHa+fqlnjArATxvaFHyTKZxYOvbTrHniQcX2rJ7ot04bUEOCl6C38MK X-Received: by 10.112.32.163 with SMTP id k3mr132530lbi.17.1418895739486; Thu, 18 Dec 2014 01:42:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.66 with SMTP id le2ls1084567lac.90.gmail; Thu, 18 Dec 2014 01:42:19 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr1214391lal.29.1418895739274; Thu, 18 Dec 2014 01:42:19 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id rr7si6327742lbb.43.2014.12.18.01.42.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 01:42:19 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id 10so648529lbg.19 for ; Thu, 18 Dec 2014 01:42:19 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr1251153laa.80.1418895739190; Thu, 18 Dec 2014 01:42:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1645968lbb; Thu, 18 Dec 2014 01:42:18 -0800 (PST) X-Received: by 10.180.206.47 with SMTP id ll15mr3469715wic.34.1418895726158; Thu, 18 Dec 2014 01:42:06 -0800 (PST) Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com. [74.125.82.49]) by mx.google.com with ESMTPS id be1si6157772wjc.162.2014.12.18.01.42.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 01:42:06 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 74.125.82.49 as permitted sender) client-ip=74.125.82.49; Received: by mail-wg0-f49.google.com with SMTP id n12so1083234wgh.8 for ; Thu, 18 Dec 2014 01:42:05 -0800 (PST) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);