]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
platform/mellanox: mlxreg-lc: Fix logic error in power state check
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Mon, 30 Jun 2025 10:58:08 +0000 (03:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:59:47 +0000 (15:59 +0200)
commit80db92281d3d5b847975afe5ecc019c5c265eb76
treeaeecea25849c9720447636cc6e46ccc5d0bddee4
parent68e9963583d11963ceca5d276e9c44684509f759
platform/mellanox: mlxreg-lc: Fix logic error in power state check

[ Upstream commit 644bec18e705ca41d444053407419a21832fcb2f ]

Fixes a logic issue in mlxreg_lc_completion_notify() where the
intention was to check if MLXREG_LC_POWERED flag is not set before
powering on the device.

The original code used "state & ~MLXREG_LC_POWERED" to check for the
absence of the POWERED bit. However this condition evaluates to true
even when other bits are set, leading to potentially incorrect
behavior.

Corrected the logic to explicitly check for the absence of
MLXREG_LC_POWERED using !(state & MLXREG_LC_POWERED).

Fixes: 62f9529b8d5c ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices")
Suggested-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://lore.kernel.org/r/20250630105812.601014-1-alok.a.tiwari@oracle.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/mellanox/mlxreg-lc.c