mlxsw: core_thermal: Use exact name of cooling devices for binding
authorVadim Pasternak <vadimp@nvidia.com>
Wed, 13 Apr 2022 15:17:32 +0000 (18:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Apr 2022 10:06:13 +0000 (11:06 +0100)
Modular system supports additional cooling devices "mlxreg_fan1",
"mlxreg_fan2", etcetera. Thermal zones in "mlxsw" driver should be
bound to the same device as before called "mlxreg_fan". Used exact
match for cooling device name to avoid binding to new additional
cooling devices.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

index 23ff214367d3b23b35b0f5ca826148b0bb9d8e56..49ea3245770319b4d89d4b4c8b029fa3e1f5ab4f 100644 (file)
@@ -129,8 +129,7 @@ static int mlxsw_get_cooling_device_idx(struct mlxsw_thermal *thermal,
 
        /* Allow mlxsw thermal zone binding to an external cooling device */
        for (i = 0; i < ARRAY_SIZE(mlxsw_thermal_external_allowed_cdev); i++) {
-               if (strnstr(cdev->type, mlxsw_thermal_external_allowed_cdev[i],
-                           strlen(cdev->type)))
+               if (!strcmp(cdev->type, mlxsw_thermal_external_allowed_cdev[i]))
                        return 0;
        }