Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp171949imd; Wed, 31 Oct 2018 16:46:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5c0CCgaXvy8Z64c4HQTy07F/QWIKuNZyjH3YW/AjgdPbtxNLmYfoBkE8+L2M+6L5KHMArAf X-Received: by 2002:a63:2045:: with SMTP id r5-v6mr4991145pgm.328.1541029564643; Wed, 31 Oct 2018 16:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029564; cv=none; d=google.com; s=arc-20160816; b=fDdKiDQzUlnXLc6HEg8TAJuP0Gkb71M1lhu3KetK3C0IyZKvW+O+8C56Qg8+/BVYN6 m3raCLDsf4972gkbXcrdj5yQ3o+VQ8al6luWSOBRjGOpITnzmILJSin2B/bu/pIlKLqi 0u6YyNTe7KQetyX+PBGEJGy5wyfI1pc7g6BaR6rBveyDuYyMhqUV4aQqobtsHV0UMJTj Pg/Q1sDI8yNde/qhZo7cVW6/ReoDjGWBbhUO5eEYyBu4jLa5gbI5Yv8ec8i3Fyku8jtM IyUoEPy1f/9EofDOwp6E10k3tTdsI4PFlolNLYrnJI+V3xyJxH4uG9i37ou5QSPEwWUm oMpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=/+m8npI4cgDkdptcExh1MTHOOMFOT5+/jAWKMQy8LUQ=; b=0o4W8AyEIOieZ0h1lEgurAmrK6fXR0DVvNYLcmNnsMZucqXk3eChqRz6r8nV/g8xBc sDYpX+rYwHNA/qDCMMtnldU4YLwuNRDlDSYzktPkkulu1LSvOgvSgs40oe350Dx6138F lvqooFIYODkMrYh2V2DnRdfHQlyDsnEr/bO47b5wRAmnRiAdxFi8UKdJPrhD/Opj3WQM 5iye9c3O4Jl7AsRJNLxc3oQgHpegXedRGqOyqV7WZh2YfRbA7iOfY4ZcrCUWqVZ59QBY bUYAOQ1glqFab5INAqOKLUvu/VrgVgGXL3V9Vo1Tb2uksD8fSrXbp+XgiAD/OgATHFea 3OdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AgCLCszi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c27-v6si29299694pgc.461.2018.10.31.16.45.50; Wed, 31 Oct 2018 16:46:04 -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; dkim=pass header.i=@kernel.org header.s=default header.b=AgCLCszi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729248AbeKAIpw (ORCPT + 99 others); Thu, 1 Nov 2018 04:45:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:55190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728646AbeKAIHZ (ORCPT ); Thu, 1 Nov 2018 04:07:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18A7320821; Wed, 31 Oct 2018 23:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027234; bh=jK+cIQ9JcQfW8qhNHAgE4ViSNpm5IcSgQ6TOo1AWZc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgCLCsziZGXU7Y6svPFWj+V1v9gwWbzQYdQWCHc9fZSxqJ2en3M8jA2ypRtH13ZHK 8rpK4IDHb484L685S7qhGoZVebQ2k3uruMsrxnWoK4PiHt3bhhGzt4WWJHxL3eudi/ 8eYrHTXWymeK6N/itLvEI199aqnKsa2fvvVc8oSw= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Tudor.Ambarus@microchip.com" , Tudor Ambarus , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 4.19 102/146] usb: host: ohci-at91: fix request of irq for optional gpio Date: Wed, 31 Oct 2018 19:04:57 -0400 Message-Id: <20181031230541.28822-102-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Tudor.Ambarus@microchip.com" [ Upstream commit 325b9313ec3be56c8e2fe03f977fee19cec75820 ] 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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); -- 2.17.1