Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1697357imw; Tue, 5 Jul 2022 13:58:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYqIDwxL+6U/96Fr9BmWnMJFu1+O2+EKbPlqMGEmLEBIv30ALKhGqW+Zwl8mO7Lzh8xSI2 X-Received: by 2002:a17:903:230d:b0:16a:73ce:9068 with SMTP id d13-20020a170903230d00b0016a73ce9068mr43850420plh.57.1657054700367; Tue, 05 Jul 2022 13:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657054700; cv=none; d=google.com; s=arc-20160816; b=cRabJB0XClZdQNZ44YtzBD/btJLEJqFEk8mOM9AJW+0YqTS3Bz3Ey1GpmyiDG8Azef Qtsf4jplaMthekhCfc5llxxse2/1+gvvWi/P1oE4zzOM+12DnfvmhMADz3psV+DSkw7b MyonQ3DtvqpZGUc5WpsMtB2SdkRi7b3lzQ9sHP70C4P+92x8sip4PMJ2WwQCjA/7P/Uq tjoJ0Lo2YzmLiF68J+e5LzRsMgRu4nkfpVtBXoMwAuWjFg1j2zG1BL1fBGItZVNbdO07 00EWVTA6d3iBrNyyGIUSQ+UJq4nxRNHVyod09eyRLXpYAmaDeGoeS6+lwfb8Flucpr56 Pshg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=xOzOlPYC9QLTNXDxfMuIfd898otegibqv7vNfNZw3/o=; b=TfGON2GLoz3A1K+ZEsfGkU7cXI4QBeev028bWC6zF7WwoQ5ImpOVUoiexQiEO2Wmt4 +z3fhuBWTjq7sGfXca3dSDD72+rOTHJ9WhF3Ka76Ldi+fEp/Uyw1OGCmJj1bD4xoCnt+ d5J39BtX47hCQWCCg+kt7AVJ1xqIerIiaNSp93H7gQwsX1hVz21MJvrtN2xRqn5VHxuH ooBAPv2eKKkjFijO52Chr8sxn4upUntWsovNWfnAPvnxHeDV18rNW3CnyRroLy3ssU8s ssU5eEXjQYboXPxHWAagqP9bYDhEodRMJmEjBgIuAxsF18kXBDQzn+mSmRA5VL2VeXxh Sv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=rc7Gmt2L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a630115000000b0040dea781c31si9981010pgb.319.2022.07.05.13.58.08; Tue, 05 Jul 2022 13:58:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=rc7Gmt2L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232147AbiGEU5L (ORCPT + 99 others); Tue, 5 Jul 2022 16:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232087AbiGEU4y (ORCPT ); Tue, 5 Jul 2022 16:56:54 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55A2D20185; Tue, 5 Jul 2022 13:56:41 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 1FC652223E; Tue, 5 Jul 2022 22:56:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1657054599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xOzOlPYC9QLTNXDxfMuIfd898otegibqv7vNfNZw3/o=; b=rc7Gmt2LNhl29R0WDdNeU3ouKO9XQLLRRarWHieIfdyp59VeXbsMfav5TpVdm1jXrN6C4w t1ZhtU7xVJLBbcKrRvhUgEq6w0AWZkOzsG0RIS3r4UqfF152aETwEEtf4rc8gJbsFdpbsa 456LPtl/dOWvUYw5OfTCbJP9bn5RWcE= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 05 Jul 2022 22:56:39 +0200 From: Michael Walle To: Saravana Kannan Cc: Cristian Birsan , Felipe Balbi , Greg Kroah-Hartman , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() In-Reply-To: References: <20220705131951.1388968-1-michael@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <7673314425958a56a07899b300226554@walle.cc> X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2022-07-05 20:53, schrieb Saravana Kannan: > On Tue, Jul 5, 2022 at 6:19 AM Michael Walle wrote: >> >> devm_gpiod_get_optional() might still return an error code, esp. >> EPROBE_DEFER. Return any errors. >> >> Signed-off-by: Michael Walle >> --- >> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c >> b/drivers/usb/gadget/udc/atmel_usba_udc.c >> index ae2bfbac603e..48355e0cee76 100644 >> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c >> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c >> @@ -2165,6 +2165,8 @@ static struct usba_ep * atmel_udc_of_init(struct >> platform_device *pdev, >> >> udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, >> "atmel,vbus", >> GPIOD_IN); >> + if (IS_ERR(udc->vbus_pin)) >> + return ERR_CAST(udc->vbus_pin); > > I'm confused. Is it really an optional resource if you treat a failure > to get it > as a reason to fail a probe? If the gpio isn't found NULL is returned. -michael