Received: by 2002:a05:7208:960e:b0:7f:5597:fa5c with SMTP id gt14csp1678428rbb; Thu, 7 Mar 2024 08:44:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXARDZ+lEMM6xMWn0FpKpX1j5QKhNzcoGbP3DEWCIiGzoIwT1wtK0f/K30Cm3lWaHUNE+badll9kYbsLI5CDXTDfu/5/YFbIYKpiv1JfQ== X-Google-Smtp-Source: AGHT+IGleqg5tZY9YnHK6qmoDY+zhgaZHoiyTExbjv7tgRqJINKX6VXCuzQjfE5o/PiJpniQR9fh X-Received: by 2002:a05:6a00:3908:b0:6e4:dfec:1b0e with SMTP id fh8-20020a056a00390800b006e4dfec1b0emr18933842pfb.19.1709829890217; Thu, 07 Mar 2024 08:44:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709829890; cv=pass; d=google.com; s=arc-20160816; b=JYMuaxwVPM/LSPabAH1oXhPzH1q4ykIaQZ5yKg+qxSiqKRusVHTXxX2LBqryeiaWdM vOFFvW2Ds+E4MvulVAZLFwMi89TdNxX9/xnSzug7J1fWSE0dLADdl8tC3U5BHgg1Ko6H V+Vt9pCCESrwjuXCq+lhb1xuZps9UmeGOS3Jg0cCSPbSY6E0y+xfDa/PuFNomdwyJaiC GZDH6n9BTeqPsUc9Tk7txVjvVY4cs0X7KUG49NLL5xkkvewGbiLI35Kld7cHpc0eJrKb BWn32bQFYeC0kjb+q40bPaZx7MUpmWHSgAAYA18y8WyVUWJB9PCug5mF1K9GbwTQUMm9 S6MA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=9E+3iMXZ6e4/cvZdr7MBA3fBZIXQ400CfkUUzeUfSpI=; fh=Vwx8gR4ULeD2OmUONfpMe8ryFyZ5b96jFIYIT13vk4Y=; b=AretN223/6NYFCIKcQvKJFp6qX4a8ITpQR/XMXTTnuJ7j9mvbyIJktc5QcED5k6W4I 8hI3dLixxdpMEl5KorBIzGS3C+2yJQcG8IuT+LpF1AWRu41Qp/AUtUY42H9iaW4qPxLX hTxxox7WcE5U/N9YnPGKgRzWfgLC7ZcXyI0yTSOMazlQL7Sd0v3Ry1luCGQ6D7Mo28Oo F/4tOHIeN5vhf1/CAIOvcqMCr0P9dEfvVEVrgAa4SIsAKOtO2hP+nN32983tdiqiBrxZ H82x6nQnmfPJniUsw93yfl8ye4u+11ePooMgGoE68uE6yegfDceV0XnbH39L/0jXrU0A QnQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-95877-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95877-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e15-20020a63ee0f000000b005cf268638f4si14069842pgi.156.2024.03.07.08.44.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 08:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95877-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-95877-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95877-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A24E728491F for ; Thu, 7 Mar 2024 16:44:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0C0912FF6E; Thu, 7 Mar 2024 16:44:05 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D70FF12FF6B for ; Thu, 7 Mar 2024 16:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709829845; cv=none; b=nDMI/PfMdn2PlDAI2Y0W/f9b0GuzIfsLbXd8brDRyrfeYFEoG+8udBb3bfZiNE4EuEdkNp1iSATj+Vqc9yPu4VZ2kPMpkUP9iTI7FqNMNEXFotN2yjABwoDvPn1Z5xnOkws3QP8/Z/3MVGpU2pFc75Wm90lsCQTWaysMjAVBhY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709829845; c=relaxed/simple; bh=QQAB0S3fJ+hrqfJ/WvLMvQROvWq80E50ppjocV13zYI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CcvEdY5O39fyOm8Q4fEqmHuceBsTVihd6XBMVvCuY/9E/m+W6NBPKSdLRyvb4yn46NUNTVj/5f7hjCkzIsdCu1vVHg5E66W8h2se0myQshDbG9ZUZnphFULmZekSjs9CEpk3njCogMPOiNLictF6RLPYjpZsueJq1JR5waL5UNo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1riGqg-0008SS-08; Thu, 07 Mar 2024 17:44:02 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) 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 1riGqf-004yh8-0H; Thu, 07 Mar 2024 17:44:01 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1riGqe-001Ovv-30; Thu, 07 Mar 2024 17:44:00 +0100 Date: Thu, 7 Mar 2024 17:44:00 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski Subject: Re: [PATCH v1 4/5] w1: gpio: Remove duplicate NULL checks Message-ID: References: <20240307143644.3787260-1-andriy.shevchenko@linux.intel.com> <20240307143644.3787260-5-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="htvmaear7d4brykf" Content-Disposition: inline In-Reply-To: <20240307143644.3787260-5-andriy.shevchenko@linux.intel.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org --htvmaear7d4brykf Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 07, 2024 at 04:35:50PM +0200, Andy Shevchenko wrote: > gpiod_set_value() is NULL-aware, no need to check that in the caller. >=20 > Signed-off-by: Andy Shevchenko > --- > drivers/w1/masters/w1-gpio.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c > index 3881f2eaed2f..8fd9fedd8c56 100644 > --- a/drivers/w1/masters/w1-gpio.c > +++ b/drivers/w1/masters/w1-gpio.c > @@ -117,8 +117,7 @@ static int w1_gpio_probe(struct platform_device *pdev) > if (err) > return dev_err_probe(dev, err, "w1_add_master device failed\n"); > =20 > - if (ddata->pullup_gpiod) > - gpiod_set_value(ddata->pullup_gpiod, 1); > + gpiod_set_value(ddata->pullup_gpiod, 1); > =20 > platform_set_drvdata(pdev, master); > =20 > @@ -130,8 +129,7 @@ static void w1_gpio_remove(struct platform_device *pd= ev) > struct w1_bus_master *master =3D platform_get_drvdata(pdev); > struct w1_gpio_ddata *ddata =3D master->data; > =20 > - if (ddata->pullup_gpiod) > - gpiod_set_value(ddata->pullup_gpiod, 0); > + gpiod_set_value(ddata->pullup_gpiod, 0); This also has the advantage to not have to know that NULL is the dummy value returned by the gpiod_get_optional() family of functions. Acked-by: Uwe Kleine-K=F6nig Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --htvmaear7d4brykf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmXp7s8ACgkQj4D7WH0S /k5H2Qf/Xf21WLfMVTOIbH9Ug/45AG+HXZAC5SplkjhLSl7UR1I6smE/wDeLGmOg UMS6kvrUfU6e20aXejNnt6qUuKFGHys3dccXRpyv1cjSDeNx9zFaitLopqWcl6eZ V18zE3rXuWBZralnT+CNFEcxGcTvrMBHHIYQRRkz1E8Ln6dY6bKVtYtFIU+npbhp lkNJPqa0x+gHFpUhIlkbX76/xOFK9pwotmZiW3xqRTlv4DyGnbJbYjO9T3mMxPUd M3Jm6bZJlFkIkQQVREbF42uxws7SEcsoIPucPTW/9jPJuoSnwKf5LXrD98xcQPla cJonaj3slqhdrgX7i4KQETu4TRxmKw== =Wy13 -----END PGP SIGNATURE----- --htvmaear7d4brykf--