From patchwork Tue Jul 8 07:23:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 33178 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2354720969 for ; Tue, 8 Jul 2014 07:24:15 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wn1sf3475029obc.3 for ; Tue, 08 Jul 2014 00:24:15 -0700 (PDT) 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:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=d9RXzfbB5z3JDAT6hX97mCkvfam9iNzQcdwUzVCLIps=; b=eBhZWsJrtyj07TybNJ3WeZSlZFik71YRh+TzSkQ98RgOoaxngZaXuXuivsntyokZo5 XA7ISQOTG9RtAqT20bAWJno4kE6U9N3YxtA4c2lhHT64qwHbGjZnZafC3CdOhlaOtdYD cNFNQ2XjUJCKwcZFYThLTRqBWEXZfbCQDX05KYl7kMfk/SZqhvgdlsdrJsNMD96XGuLk hiTrTY2KqVsOZtXMp+KOK/C5X5wekc8HkbdMJK0quj3GTR7w4AFoQ0ZE3wOCR20MLBNG f71sWzaIxPeQGth0KqJ8/tjZcMAiKvTSyCXzzkdjZodPzq3waKmg+2+5bkHtBXnrql7h COUg== X-Gm-Message-State: ALoCoQnuncDXTqphd+ijIfnW7OBDWChGrgLwdatOx08bhbw3IferkX0JTPVwQl4lYnYdzz44B1y0 X-Received: by 10.182.45.161 with SMTP id o1mr16707674obm.2.1404804255543; Tue, 08 Jul 2014 00:24:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.195 with SMTP id b61ls2114594qgb.50.gmail; Tue, 08 Jul 2014 00:24:15 -0700 (PDT) X-Received: by 10.220.163.3 with SMTP id y3mr32246435vcx.7.1404804255412; Tue, 08 Jul 2014 00:24:15 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id dn3si19819558vcb.40.2014.07.08.00.24.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 00:24:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so5117481vcb.10 for ; Tue, 08 Jul 2014 00:24:15 -0700 (PDT) X-Received: by 10.58.198.67 with SMTP id ja3mr32404666vec.10.1404804255335; Tue, 08 Jul 2014 00:24:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp747401vcb; Tue, 8 Jul 2014 00:24:14 -0700 (PDT) X-Received: by 10.68.103.98 with SMTP id fv2mr33669112pbb.18.1404804254371; Tue, 08 Jul 2014 00:24:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si3673650pdo.306.2014.07.08.00.24.13; Tue, 08 Jul 2014 00:24:13 -0700 (PDT) Received-SPF: none (google.com: linux-gpio-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752836AbaGHHYN (ORCPT + 1 other); Tue, 8 Jul 2014 03:24:13 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:50782 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752230AbaGHHYM (ORCPT ); Tue, 8 Jul 2014 03:24:12 -0400 Received: by mail-wi0-f176.google.com with SMTP id n3so410135wiv.15 for ; Tue, 08 Jul 2014 00:24:11 -0700 (PDT) X-Received: by 10.180.186.97 with SMTP id fj1mr1739543wic.18.1404804251522; Tue, 08 Jul 2014 00:24:11 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-656-01-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id da9sm3762639wib.5.2014.07.08.00.24.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 00:24:10 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: vr41xx: fix up errorpath on probe() Date: Tue, 8 Jul 2014 09:23:28 +0200 Message-Id: <1404804208-16279-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@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.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The driver was not checking the return value from gpiochip_add() properly, so add a bail-out check. Reported-by: Rickard Strandqvist Signed-off-by: Linus Walleij --- drivers/gpio/gpio-vr41xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c index 66cbcc108e62..dbf28fa03f67 100644 --- a/drivers/gpio/gpio-vr41xx.c +++ b/drivers/gpio/gpio-vr41xx.c @@ -515,7 +515,7 @@ static int giu_probe(struct platform_device *pdev) struct resource *res; unsigned int trigger, i, pin; struct irq_chip *chip; - int irq, retval; + int irq, ret; switch (pdev->id) { case GPIO_50PINS_PULLUPDOWN: @@ -544,7 +544,11 @@ static int giu_probe(struct platform_device *pdev) vr41xx_gpio_chip.dev = &pdev->dev; - retval = gpiochip_add(&vr41xx_gpio_chip); + ret = gpiochip_add(&vr41xx_gpio_chip); + if (!ret) { + iounmap(giu_base); + return -ENODEV; + } giu_write(GIUINTENL, 0); giu_write(GIUINTENH, 0);