From nobody Thu Nov 28 10:45:55 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 3663B567D; Wed, 2 Oct 2024 16:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727886551; cv=none; b=im4ltXp8R7RlMi4YqNOxRoW8b4Nmm06fJZNeQ1wCPbeous2cnN9I4wVr53UaD5Sf+pWGo6T45BN6HXSLOz0RshOLzvlacxYW1kn6F6fwGf+NjmugNT8otRQpb6z+N8MdZRS2qbnOqaZu4GL7nNoIRF75gn34sMloBEzxLVs392U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727886551; c=relaxed/simple; bh=FdyIlP5QbAoJSErExFHqxvHzcDD2538/OXE26emypME=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Udb8VoZyV3N/pNcVOr8FT1ov0Br/pHblUY+wKxwx9a7C3mT28QFuri5EWSF0KNsqpgMp4g5rjF4hnC6XvpKpLzKCwKYqgvUaXar9+dbLVlN0qlfgAJRsHNhHIgjsxG+vMxUj1620HfIQN4K6HIRTNa1+W7y19rKZ6a7O7xAxauM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ZbI5plEk; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ZbI5plEk" Received: by mail.gandi.net (Postfix) with ESMTPSA id C167F1BF209; Wed, 2 Oct 2024 16:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727886547; 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=Ro47lYTPlToHjrMRk1db8NcTTZn4FWYXgojohtwvs0E=; b=ZbI5plEk+PFgezSJr60mckUjxT7KeGbgQcqG7OlR4FYkhAh8iaAuB3qMnbX1tsKQoB/5/v jESKCdgmLeukCiUkkw6X6/dBs37V1U0LS10XKvfoablOT5zqTqjcNRYeKc/KGWpEt5AjQF fietJNA2SdFnX0SqeiWLqKg+bx2djpDqIrRSdsZOJdpXNfmB7En+xlg0rFFjbbC3uXt0VI sQbFiKhCd8ckdvX9PuClaUSSezkHy2r+2mXE65GbDJw+PViSoPnq9fQSayeQDLUWJQyD7U XQoZpZDqDVwLjVqs9ncCI+cNbX96Ui2gVoQlxNyNWDECltbY3cW0WVY6jlMasQ== From: Kory Maincent Date: Wed, 02 Oct 2024 18:27:58 +0200 Subject: [PATCH net-next 02/12] net: pse-pd: tps23881: Correct boolean evaluation for bitmask checks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-feature_poe_port_prio-v1-2-787054f74ed5@bootlin.com> References: <20241002-feature_poe_port_prio-v1-0-787054f74ed5@bootlin.com> In-Reply-To: <20241002-feature_poe_port_prio-v1-0-787054f74ed5@bootlin.com> To: Oleksij Rempel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Donald Hunter Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, Kyle Swenson , Dent Project , kernel@pengutronix.de, Kory Maincent X-Mailer: b4 0.15-dev-8cb71 X-GND-Sasl: kory.maincent@bootlin.com From: Kory Maincent (Dent Project) Update misleading boolean evaluation when checking bitmask values. The existing code directly assigned the result of bitwise operations to a boolean variable, which is not consistent with later assignments. This has been corrected by explicitly converting the bitmask results to boolean using the !! operator, ensuring proper code consistency Acked-by: Oleksij Rempel Signed-off-by: Kory Maincent --- drivers/net/pse-pd/tps23881.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c index 5c4e88be46ee..1a57c55f8577 100644 --- a/drivers/net/pse-pd/tps23881.c +++ b/drivers/net/pse-pd/tps23881.c @@ -139,9 +139,9 @@ static int tps23881_pi_is_enabled(struct pse_controller= _dev *pcdev, int id) =20 chan =3D priv->port[id].chan[0]; if (chan < 4) - enabled =3D ret & BIT(chan); + enabled =3D !!(ret & BIT(chan)); else - enabled =3D ret & BIT(chan + 4); + enabled =3D !!(ret & BIT(chan + 4)); =20 if (priv->port[id].is_4p) { chan =3D priv->port[id].chan[1]; @@ -172,11 +172,11 @@ static int tps23881_ethtool_get_status(struct pse_con= troller_dev *pcdev, =20 chan =3D priv->port[id].chan[0]; if (chan < 4) { - enabled =3D ret & BIT(chan); - delivering =3D ret & BIT(chan + 4); + enabled =3D !!(ret & BIT(chan)); + delivering =3D !!(ret & BIT(chan + 4)); } else { - enabled =3D ret & BIT(chan + 4); - delivering =3D ret & BIT(chan + 8); + enabled =3D !!(ret & BIT(chan + 4)); + delivering =3D !!(ret & BIT(chan + 8)); } =20 if (priv->port[id].is_4p) { --=20 2.34.1