Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1017096rdb; Wed, 6 Dec 2023 06:36:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmVkDO322GgPAuYqF8QJFW1LTl/+Bml0zpUyA3sD4XJ5bpwjjx8x2Lq/CiM9s8A8QicWWr X-Received: by 2002:a05:6a00:4088:b0:6ce:3c1e:743f with SMTP id bw8-20020a056a00408800b006ce3c1e743fmr1056967pfb.41.1701873369817; Wed, 06 Dec 2023 06:36:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701873369; cv=none; d=google.com; s=arc-20160816; b=geweCgsNcxyyv14Zl9wpBqN9vf5RbhAXU7uu6xc6zquND92bdhd+D76Vh6x7+sgCWA FrPUdCDq7rpbW+/VJ0Bkp2CtN67q54lB27wvmUZAxY4loAObBOGTdUZ144CXCDhqk7Gh P5PQfLw+bv2KVjmhUUd4EYSuWimKTncEEO9l1pTisqB52Aq7wM8jc/am1OW2A1w2Nleb 4GiKtZC+tMk4iCUJ8FgzPF5hwTUdnbk66K30ZJOmrdguS5HduAJyI3abjm+/8JltdMQM U+tHYeNYqcBv7OSo2oyNmUcBLZzMq84YmtBuZLJ3+d2/wvIkNyzHpc91J0gKFTEJdQkR cuqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=ieewH+ublndTW1qYLAKyk+G/XD6+mdjCK9l+zowMzqg=; fh=Z4b8Aj3knAix0mRWvnl84SQ2mQb+iSXmPfPt1qBgvmo=; b=LDcLT+jEo7L/5WstMaq21+kMd3I4V9q/nv33lKs4KKPIsQaVPYESohqCcKXak50Dxk 0bodtREHedloN/CP9CAZmfgS7SLLBkbTfh4RZ0WhyjVy3n5Cauou/3Ic3glpBBjE82Qy +PGzyZupaw2xxwghDSWXuHdXtWdB2blgKJ+KjlCd57AM+g74jk+sNjvJn1klORLadPOj /HIjl9zzfNWfxYRMPUloUR5hOyUE0nMmkxVpURt8UgVvR686hKLTp84IGcGlZ1XuIEPS Jl9mANJmyTtmQ38ORqJz2ZhUZD8PJLbjurr9zVbCDx4WuJYbXLCs5imIZQOAchUV5VCR t6ZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-502-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-502-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id fn4-20020a056a002fc400b006cde2f43c62si31065pfb.354.2023.12.06.06.36.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 06:36:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-502-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-502-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-502-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 225ACB20F4C for ; Wed, 6 Dec 2023 14:36:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAA5E3EA76; Wed, 6 Dec 2023 14:36:03 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F175FD5F for ; Wed, 6 Dec 2023 06:35:58 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rAt0G-000789-Ha; Wed, 06 Dec 2023 15:35:56 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAt0F-00Dz2R-IV; Wed, 06 Dec 2023 15:35:55 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1rAt0F-000EYR-1c; Wed, 06 Dec 2023 15:35:55 +0100 Message-ID: Subject: Re: [PATCH] net: rfkill: gpio: set GPIO direction From: Philipp Zabel To: Rouven Czerwinski , Johannes Berg , Josua Mayer , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Eric Dumazet , kernel@pengutronix.de, Jakub Kicinski , Paolo Abeni , "David S. Miller" Date: Wed, 06 Dec 2023 15:35:55 +0100 In-Reply-To: <6e3049e37b00e2e5a5f02bff7b75d6c9282973b5.camel@pengutronix.de> References: <20231206131336.3099727-1-r.czerwinski@pengutronix.de> <6e3049e37b00e2e5a5f02bff7b75d6c9282973b5.camel@pengutronix.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Hi Rouven, On Mi, 2023-12-06 at 14:24 +0100, Rouven Czerwinski wrote: > Hi Johannes, >=20 > On Wed, 2023-12-06 at 14:16 +0100, Johannes Berg wrote: > > On Wed, 2023-12-06 at 14:13 +0100, Rouven Czerwinski wrote: > > >=20 > > > +++ b/net/rfkill/rfkill-gpio.c > > > @@ -126,6 +126,16 @@ static int rfkill_gpio_probe(struct > > > platform_device *pdev) > > > =C2=A0 return -EINVAL; > > > =C2=A0 } > > > =C2=A0 > > > + if (rfkill->reset_gpio) > > > + ret =3D gpiod_direction_output(rfkill->reset_gpio, > > > true); > > > + if (ret) > > > + return ret; > > > + > > > + if (rfkill->shutdown_gpio) > > > + ret =3D gpiod_direction_output(rfkill- > > > > shutdown_gpio, true); > > > + if (ret) > > > + return ret; > > >=20 > >=20 > > That's weird, you need ret to be inside the if. It's even entirely > > uninitialized if you don't have ACPI, if you don't have > > reset/shutdown. >=20 > Thanks for the review, you are totally right, I didn't look at the ret > initialization. I moved it inside the if for v2. The if-block is not required at all, gpiod_direction_output(NULL, ...) will just return 0 from VALIDATE_DESC(). regards Philipp