From patchwork Mon Oct 15 09:00:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10641367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3867213AD for ; Mon, 15 Oct 2018 09:01:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2691329692 for ; Mon, 15 Oct 2018 09:01:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A91A2968F; Mon, 15 Oct 2018 09:01:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F26D29696 for ; Mon, 15 Oct 2018 09:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=RHp93zPmHUMsVBnp5h0VThka9Gwsq2yCuwSxg+dftB4=; b=qCMyD3iL3wcFGp FwTpo2q/WzFvoZJtEAPqtO4aWD70otD2sYbphBzvhzMfFLkZZPpiW7rTNuuS2RvLkUqalF00XNeiC FnwWwAL5ke8kYnPdKGLRuFzb5+k+BWDYHuyX8McjUAjhFd8JOovAVkHSVKJITYyFOWyTFaRmxR/hp v0v3pF4qrZTK4s6dK33g3OzHjjtbGxfWSdnHCjExZEmJpZPLPvJpZrmkYfWrjrbugbfPgTgk8rrTJ 02hVopEYtt2FRb2TY4Embnhk88oF762DcGhBQs63ho16jBXqqdlPKg31+6TpPlf4iAoMlSuxIknxM LzYmMBUD/dFLDBTV8uCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBykV-0001Hx-EQ; Mon, 15 Oct 2018 09:01:15 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBykQ-0001G2-LB for linux-arm-kernel@lists.infradead.org; Mon, 15 Oct 2018 09:01:12 +0000 X-IronPort-AV: E=Sophos;i="5.54,384,1534834800"; d="scan'208";a="21542309" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Oct 2018 02:00:58 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 15 Oct 2018 02:00:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sb8uiQZWI9jLu14kj09fjpuWjYrhURYQaU7hp+S2CE0=; b=CREmGrZgHd7MQ0KbcLhZVBtACHTC8JhntKrzluFL9/Ynlfn3vkB3ndlTTVxegZHvE1fj2xP6sItcZy6sDF7e4A1FlUEnqjnRZ5OMjMEUS4HkJtxN5K7sGNoYuzoShip6I0ogzCIS+PntUfHnYx9m7iKyGz9sNX2+8ZrV7FIsFaI= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.99.146) by BN6PR11MB1332.namprd11.prod.outlook.com (10.173.32.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Mon, 15 Oct 2018 09:00:55 +0000 Received: from BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::c157:ea7:fc3d:f9a4]) by BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::c157:ea7:fc3d:f9a4%10]) with mapi id 15.20.1228.027; Mon, 15 Oct 2018 09:00:55 +0000 From: To: , , , , , , , Subject: [PATCH v2] usb: host: ohci-at91: fix request of irq for optional gpio Thread-Topic: [PATCH v2] usb: host: ohci-at91: fix request of irq for optional gpio Thread-Index: AQHUZGWUHyQspvTY9E2F8as35fJ9jA== Date: Mon, 15 Oct 2018 09:00:54 +0000 Message-ID: <20181015090001.5195-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0801CA0078.eurprd08.prod.outlook.com (2603:10a6:800:7d::22) To BN6PR11MB1842.namprd11.prod.outlook.com (2603:10b6:404:103::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tudor.Ambarus@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR11MB1332; 6:g6Hyn/PfS8w6djq7dV3aOXyp9LncAqXfUD8R96MpBG4mRtBW1MpHsKSm3qHCxmCh/U4R3Erke+ZHqECb8pp9cvzcKr5jAxnB0R1+202Qa5W9l0/twUNAgF3oL8vsSNFsed+gpa3ANoRGFXNYw6/XffewBOx1Sdl4XmFxffSce7qBTK82v6Ow3xjJMRcavGpIrOJAabQP3+TJ56tY8MAMJ3Fgtl5j1NMPzBMsK64XdqIY10kdmWf1sG3m+6D3/kPz9TNvQLBwZgA7RtqwOtvLG/Cutw9teVQInu4eu7HO4VAP5MJitUi+j0rLb30UlM/+DorbQDOmbB4AB2W1BSiH2Bh3hew6xn6qBh96M3ntjJM1kaFnK1GVYGRvvARqbs7Sk+iLePLCIeFT6GYkyrQQDHIIAfS7ZtDZh8J0NrVF1q3iSZYcbZv54blUMB3r4WtXR5y27ovJmw3t0GDApp1qDw==; 5:pce7l/fbFFiGo3v0zJGAGrABIbPRQDiuwkbQyiLMTEniM2iAvOzbsYjeWWCK4MFcNOoQiqt4S1j3GwgDsNrj0NCnfwqT7fVWeYg0EG1J4c7Ayz+3EgcZyx6LcjbfNg5oopbbNeqYoiidn2jVQVDCMPbSPMTw3Mf+B6la/sTjMr0=; 7:2e2Gl+LNXMTfkF0oBIFeFBueoXxWO4gb5vLAqAfjIOaZLOVd6p/Atmh5sOplQNqmEPrDKkfGWkld3Mq69vShoE1VUdeAn2FwEPtacfg6S6hAjmf979hUDTLsOqcrAi0uey/CF1OB/+jdUr19RCeQemCqv2Yl0a4AL/qOrm/ST9yruTy0zLDjBq12X7dBY9twdeFLW4r1IDkQKeMGWuuc3uf9xk0JkdRqKLU3N0j9p4bETC4LGoKknDB1KTfd8iB4 x-ms-office365-filtering-correlation-id: a1773d18-2c6a-4270-5ea1-08d6327cb6d3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BN6PR11MB1332; x-ms-traffictypediagnostic: BN6PR11MB1332: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(84791874153150); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:BN6PR11MB1332; BCL:0; PCL:0; RULEID:; SRVR:BN6PR11MB1332; x-forefront-prvs: 0826B2F01B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(136003)(376002)(189003)(199004)(5250100002)(36756003)(5660300001)(6486002)(66066001)(6436002)(2501003)(6506007)(8676002)(2900100001)(478600001)(256004)(68736007)(386003)(14444005)(107886003)(3846002)(316002)(52116002)(6116002)(2616005)(71190400001)(71200400001)(476003)(7736002)(14454004)(305945005)(486006)(2171002)(97736004)(6512007)(2906002)(4326008)(6306002)(102836004)(186003)(72206003)(1076002)(25786009)(105586002)(99286004)(966005)(81166006)(81156014)(86362001)(26005)(8936002)(2201001)(110136005)(106356001)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR11MB1332; H:BN6PR11MB1842.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: aSp372WGPF+DirFXnGrA9Oc2Z9k/67P8Z3tbgNUr8Idl9t80JXEOc4W8kZ+OMl+ZkrQKOEtL4HTzW+ZPzuZa7XDkplBihvTZ03pq1FOSJIDaM6Z0WE1oq2z4A9b1th7/5waoHY5pbGdI4eEXMqJiNxj2VjXMogf1KG2cz6QyjG4N7kuzi9oDSg9C5RUOsdJgSAJcWQ0zlOSPkmbNy7uZza0CGZMR45+vjXWlKZylEqKlgzRlzLckNTeje37KOB8jlkjS6QpbAaAV+qz1G1MnRCGVCAmi1ObsyNgFjh+oaaiDkuQdctBnfR9BiYsfxn2ss4asj4F6Yo/bsfh38Grakqnwd/BpRdr1PI1eDwQDTcw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a1773d18-2c6a-4270-5ea1-08d6327cb6d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Oct 2018 09:00:54.9097 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1332 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181015_020110_777690_D4D6C217 X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tudor.Ambarus@microchip.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Nicolas Ferre Acked-by: Alan Stern --- 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);