]> git.itanic.dy.fi Git - linux-stable/commitdiff
PCI/ASPM: Return U32_MAX instead of bit magic construct
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 15 Sep 2023 15:57:48 +0000 (18:57 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 10 Oct 2023 21:03:51 +0000 (16:03 -0500)
Instead of returning a bit obscure -1U, make code's intent of returning
the maximum representable value more obvious by returning U32_MAX.

Link: https://lore.kernel.org/r/20230915155752.84640-4-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/aspm.c

index 06f175d8dee575773c670a07f37cf033ca4e0d1c..4cd11ab2723304110a2c87a417d3d84c452f03ff 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/bitfield.h>
 #include <linux/kernel.h>
+#include <linux/limits.h>
 #include <linux/math.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -279,7 +280,7 @@ static u32 calc_l0s_latency(u32 lnkcap)
 static u32 calc_l0s_acceptable(u32 encoding)
 {
        if (encoding == 0x7)
-               return -1U;
+               return U32_MAX;
        return (64 << encoding);
 }
 
@@ -297,7 +298,7 @@ static u32 calc_l1_latency(u32 lnkcap)
 static u32 calc_l1_acceptable(u32 encoding)
 {
        if (encoding == 0x7)
-               return -1U;
+               return U32_MAX;
        return (1000 << encoding);
 }