Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4055146imm; Mon, 15 Oct 2018 08:24:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV62l9rFR8crveDM481cqy6BZKdvm0b5JVRb5GkBekTKGAcSINwLbPFQsVwCgT0AQ4l+MiR5C X-Received: by 2002:a62:4803:: with SMTP id v3-v6mr18595068pfa.89.1539617085548; Mon, 15 Oct 2018 08:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539617085; cv=none; d=google.com; s=arc-20160816; b=I75GXhktPkUspk3zRWG5/0+TFtJGDwWLpg2BUQSWdmFWlV5vIPM75Eey2ldHPbl5sY Zxk0bOYXmY/33nY+HEzNK2eKeYuBVArUd1evCqXKdxzrs/uq+iSeXTkMTtsfmTOcnDjT h4gxX/4uvonx9Yk0yACD2xTNC+eZJhzKMZXpBqDT0S/p+ElxacCcSic5VXAy+EL42kIf +LnRKM/J7KX8+VFHMOv6szSEGkuS9MvkL0iUMxbNYRiLd0mWjYOGwajRtG21f/qlmXW5 9oolIl2yPQgyQpC7ZKzMeCec1Ppuhi58nsko6PSpCV8C+fHjZ41Ma0tks+XJFzOuy2VU Givg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=6fW3AKLKzgMH69+42PDWIGyyfj2SMhVXChGHD143R2s=; b=gHSlcw3u6nWCrAvyKOJg+ORKW3hM5Ucl7+9AK1ELIbDbLEJljQD6PRo2yQ+khGpzSm Eo/GV4HMG5OOLOUVVCZutv/mpZP672NVSF5RzzP4jkZrD1Ajf9crmgQtIN/lM5yyVIrn qbHtWi4HQVXHrE9l+Wxnwtqd4UKmO9qBZNOmAF/1Whxz64KfuVN0qQUYA2i6VCbpv4PI WGPtgidOKgYDac1yqa38Yv7I0Gv2cPU8oZCZk+y3uvjyfZQ6DAhoU+p8S4MkjQVfIzME X6ZYBzwZ70mT/rF+SsJDOOBxrZsWTBIhyLZzyQs1unzsGWCKmKyf/gkdnj110JFh4M7u vCqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13-v6si11131632pgi.73.2018.10.15.08.24.31; Mon, 15 Oct 2018 08:24:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbeJOXJ1 (ORCPT + 99 others); Mon, 15 Oct 2018 19:09:27 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:55270 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726526AbeJOXJ1 (ORCPT ); Mon, 15 Oct 2018 19:09:27 -0400 Received: (qmail 2198 invoked by uid 2102); 15 Oct 2018 11:23:44 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 15 Oct 2018 11:23:44 -0400 Date: Mon, 15 Oct 2018 11:23:44 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Tudor.Ambarus@microchip.com cc: gregkh@linuxfoundation.org, , , , , , Subject: Re: [PATCH v2] usb: host: ohci-at91: fix request of irq for optional gpio In-Reply-To: <20181015090001.5195-1-tudor.ambarus@microchip.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Oct 2018 Tudor.Ambarus@microchip.com wrote: > atmel,oc-gpio is optional. Request its irq only when atmel,oc is set > in device tree. > > devm_gpiod_get_index_optional returns NULL if -ENOENT. Check its > return value for NULL before error, because it is more probable that > atmel,oc is not set. > > This fixes the following errors on boards where atmel,oc is not set in > device tree: > [ 0.960000] at91_ohci 500000.ohci: failed to request gpio "overcurrent" IRQ > [ 0.960000] at91_ohci 500000.ohci: failed to request gpio "overcurrent" IRQ > [ 0.970000] at91_ohci 500000.ohci: failed to request gpio "overcurrent" IRQ > > Signed-off-by: Tudor Ambarus > --- > v2: fix typos in commit message s/it's/its, s/probably/probable > > Based on https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git, > usb-next branch. > > drivers/usb/host/ohci-at91.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c > index e98673954020..ec6739ef3129 100644 > --- a/drivers/usb/host/ohci-at91.c > +++ b/drivers/usb/host/ohci-at91.c > @@ -551,6 +551,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) > pdata->overcurrent_pin[i] = > devm_gpiod_get_index_optional(&pdev->dev, "atmel,oc", > i, GPIOD_IN); > + if (!pdata->overcurrent_pin[i]) > + continue; > if (IS_ERR(pdata->overcurrent_pin[i])) { > err = PTR_ERR(pdata->overcurrent_pin[i]); > dev_err(&pdev->dev, "unable to claim gpio \"overcurrent\": %d\n", err); Acked-by: Alan Stern