From patchwork Tue Nov 20 14:04:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13001 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6844B23FC0 for ; Tue, 20 Nov 2012 14:04:56 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 12EAEA182F9 for ; Tue, 20 Nov 2012 14:04:55 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so1718418iag.11 for ; Tue, 20 Nov 2012 06:04:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=EUiShz6oC1aei7hF/DwvJdvzy9Q1RYFqKr+KHcUmK4k=; b=SsiIc3SbMiNAtwBQt1xjGFtpWgkCOqORoaeqYMhuUOpRaEHAPrnWbkzo8GeIrMRC8h u1aha0bPqQ7dhJQnasL5PS79GYxnC7TGfIMI9JCJAquhxrJD1n7O19ijqZEVbOaenTaK MjrVY9CzvdNv8BGslATywKcJ8bgr69+yk8+uoWqTzgyinQlV8z80545H1QMDVsLVHwzF 0BqIl4HR6T82A4/6AjJHtKLZjwFFI4/2of9cIddUOPCUlSxuiPMntI0rMb8IsPVZ7wGo 1gbz4LmIu5f6TWwl48r9Th5XdkiG6L3Vlhglptv/QClke+8ZfSsPpuEU5LBSPdaVsIXr bWPg== Received: by 10.43.7.132 with SMTP id oo4mr14035396icb.6.1353420295835; Tue, 20 Nov 2012 06:04:55 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp322315igt; Tue, 20 Nov 2012 06:04:55 -0800 (PST) Received: by 10.14.203.69 with SMTP id e45mr34361680eeo.38.1353420294956; Tue, 20 Nov 2012 06:04:54 -0800 (PST) Received: from eu1sys200aog116.obsmtp.com (eu1sys200aog116.obsmtp.com [207.126.144.141]) by mx.google.com with SMTP id m3si3970244een.32.2012.11.20.06.04.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 06:04:54 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKUKuN/oLzYhIWB6pQeEUfuFh03BdHxJq+@postini.com; Tue, 20 Nov 2012 14:04:54 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 37B7157; Tue, 20 Nov 2012 14:04:09 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 84DD461; Tue, 20 Nov 2012 09:11:44 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id D07AC24C2F1; Tue, 20 Nov 2012 15:04:37 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 20 Nov 2012 15:04:44 +0100 From: Linus Walleij To: , , Shiraz Hashim , Viresh Kumar Cc: Stephen Warren , Anmar Oueja , Grant Likely , Linus Walleij Subject: [PATCH 4/7] gpiolib: return any error code from range creation Date: Tue, 20 Nov 2012 15:04:42 +0100 Message-ID: <1353420282-18066-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQn+d/ZAiCuDMvq06iqvqfiqkr2ezws/EuRRgS/y3s2QQpiKTjYj5WSoEPg4e2UIeLBvsuOH From: Linus Walleij If we try to create a range for a certain GPIO chip and the target pin controller is not yet available it may return a probe deferral error code, so handle this all the way our by checking the error code. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a59d13d..317ff04 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1218,10 +1218,11 @@ int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, pin_range->range.npins = npins; pin_range->pctldev = pinctrl_find_and_add_gpio_range(pinctl_name, &pin_range->range); - if (!pin_range->pctldev) { + if (IS_ERR(pin_range->pctldev)) { pr_err("%s: GPIO chip: could not create pin range\n", chip->label); kfree(pin_range); + return PTR_ERR(pin_range->pctldev); } pr_debug("%s: GPIO chip: created GPIO range %d->%d ==> PIN %d->%d\n", chip->label, offset, offset + npins - 1,