From patchwork Mon Mar 2 22:36:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 23969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from wa-out-1516.google.com (wa-out-1516.google.com [209.85.146.163]) by ozlabs.org (Postfix) with ESMTP id 03CBDDDED9 for ; Tue, 3 Mar 2009 09:37:53 +1100 (EST) Received: by wa-out-1516.google.com with SMTP id j8so989799wah.1 for ; Mon, 02 Mar 2009 14:37:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received :received:date:from:to:cc:subject:message-id:in-reply-to:references :x-mailer:mime-version:content-type:x-spam-status :x-spam-checker-version:x-mimedefang-filter:x-scanned-by:reply-to :sender:precedence:x-google-loop:mailing-list:list-id:list-post :list-help:list-unsubscribe:x-beenthere-env:x-beenthere; bh=QXqFWfUsPEceWli+A2RJFqng+CCQGTqhUqDfl01A7U8=; b=Hvca6nXroNp3Zpw0ajEHCt75pvE6k9taCFEUvHvc8w1IDvNx3jVVJ7fQv0K+ccTtMo 1hXJXl86GxAuntzMQ0ix+Rb5Eh8lHUuiWJhcv+JYdSViJmDyybiMYRZozVq7dubdSeTJ /r578mtXN42fMdQVNOLchAiCo2aeggTvvvCrQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:date :from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:x-spam-status:x-spam-checker-version :x-mimedefang-filter:x-scanned-by:reply-to:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=bYj29HavlkL6v6kxciZhQzjyb3+9vEl7YN3auNO7+XIIo5ehTuNWm5yFwwWEeG96Qm PD6v5dB0vJuDcawjRaHrQjybm27Ey08/v1P/KZIiLE19etqR7XdsUS1/c8vNCRrtiu/7 JzHbVF1eaNPEoCNRTEL4ZO0UfZKeV50IIm1xU= Received: by 10.142.242.8 with SMTP id p8mr490732wfh.12.1236033468597; Mon, 02 Mar 2009 14:37:48 -0800 (PST) Received: by 10.106.62.5 with SMTP id k5gr1967pra.0; Mon, 02 Mar 2009 14:37:48 -0800 (PST) X-Sender: akpm@linux-foundation.org X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.143.5.20 with SMTP id h20mr942268wfi.15.1236033467728; Mon, 02 Mar 2009 14:37:47 -0800 (PST) Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by mx.google.com with ESMTP id k32si16645wah.1.2009.03.02.14.37.47; Mon, 02 Mar 2009 14:37:47 -0800 (PST) Received-SPF: pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.13 as permitted sender) client-ip=140.211.169.13; Authentication-Results: mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.13 as permitted sender) smtp.mail=akpm@linux-foundation.org Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n22Ma6rn018994 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Mar 2009 14:36:07 -0800 Received: from akpm.corp.google.com (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id n22Ma4cE029676; Mon, 2 Mar 2009 14:36:05 -0800 Date: Mon, 2 Mar 2009 14:36:04 -0800 From: Andrew Morton To: Mike Rapoport Cc: alessandro.zummo@towertech.it, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, raph@8d.com, mike@compulab.co.il, David Brownell Subject: [rtc-linux] Re: [PATCH] rtc-v3020: add ability to access v3020 chip with GPIOs Message-Id: <20090302143604.57bd4f53.akpm@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.20; i486-pc-linux-gnu) Mime-Version: 1.0 X-Spam-Status: No, hits=-4.952 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Reply-To: rtc-linux@googlegroups.com Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.com On Mon, 2 Mar 2009 13:40:57 +0200 Mike Rapoport wrote: > +static int v3020_gpio_map(struct v3020 *chip, struct platform_device *pdev, > + struct v3020_platform_data *pdata) > +{ > + int i, err; > + > + v3020_gpio[V3020_CS].gpio = pdata->gpio_cs; > + v3020_gpio[V3020_WR].gpio = pdata->gpio_wr; > + v3020_gpio[V3020_RD].gpio = pdata->gpio_rd; > + v3020_gpio[V3020_IO].gpio = pdata->gpio_io; > + > + for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) { > + err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name); > + if (err) > + goto err_request; > + > + gpio_direction_output(v3020_gpio[i].gpio, 1); > + } > + > + chip->gpio = v3020_gpio; > + > + return 0; > + > +err_request: > + for (; i >= 0; i--) > + gpio_free(v3020_gpio[i].gpio); > + > + return err; > +} It needs this fix, I think? fix off-by-one in error path --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. -~----------~----~----~----~------~----~------~--~--- --- a/drivers/rtc/rtc-v3020.c~rtc-v3020-add-ability-to-access-v3020-chip-with-gpios-fix +++ a/drivers/rtc/rtc-v3020.c @@ -136,7 +136,7 @@ static int v3020_gpio_map(struct v3020 * return 0; err_request: - for (; i >= 0; i--) + while (--i >= 0) gpio_free(v3020_gpio[i].gpio); return err;