Fix handling of lanesInUse default value

phophor-dbus-interfaces changes the default of lanesInUse to MAXINT by
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/53650

Thus bmcweb also changes the logic to show the field as null if it is
MAXINT.

Change-Id: Ib229112374eb5a65e0a8ac97669c09c498ac26c7
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index e62dc42..3cfed3a 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -29,6 +29,8 @@
 #include <sdbusplus/asio/property.hpp>
 #include <sdbusplus/unpack_properties.hpp>
 
+#include <limits>
+
 namespace redfish
 {
 
@@ -479,11 +481,19 @@
         }
     }
 
-    // The default value of LanesInUse is 0, and the field will be
-    // left as off if it is a default value.
-    if (lanesInUse != nullptr && *lanesInUse != 0)
+    if (lanesInUse != nullptr)
     {
-        asyncResp->res.jsonValue["PCIeInterface"]["LanesInUse"] = *lanesInUse;
+        if (*lanesInUse == std::numeric_limits<size_t>::max())
+        {
+            // The default value of LanesInUse is "maxint", and the field will
+            // be null if it is a default value.
+            asyncResp->res.jsonValue["PCIeInterface"]["LanesInUse"] = nullptr;
+        }
+        else
+        {
+            asyncResp->res.jsonValue["PCIeInterface"]["LanesInUse"] =
+                *lanesInUse;
+        }
     }
     // The default value of MaxLanes is 0, and the field will be
     // left as off if it is a default value.