Update Links of Memory Patch

This patch had a bug that would create a field only when using expand parameter. This was due to a faulty efficient expand handler.

Testing:
`wget -qO- http://localhost:80/redfish/v1/Systems/system/Memory?\$expand=.`

Does not produce the portion below anymore in the Collection resource
  "Location": {
    "PartLocation": {
      "LocationType": "Slot"
    }
  },

Tested: done
Google-Bug-Id: 263797854
Change-Id: I33a82aee7ea6e381b0e0fa3ae6172245049a7fe5
Signed-off-by: Edward Lee <edwarddl@google.com>
diff --git a/recipes-phosphor/interfaces/bmcweb/0027-Links-of-Memory-resource.patch b/recipes-phosphor/interfaces/bmcweb/0027-Links-of-Memory-resource.patch
index 81807f1..eb76724 100644
--- a/recipes-phosphor/interfaces/bmcweb/0027-Links-of-Memory-resource.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0027-Links-of-Memory-resource.patch
@@ -1,6 +1,6 @@
-From 042305db4f6f3a16965b233c371ab3570fd0f3ec Mon Sep 17 00:00:00 2001
-From: Nan Zhou <nanzhoumails@gmail.com>
-Date: Sat, 9 Jul 2022 19:29:32 +0000
+From d8420ff5a2b9788bd7e41ee917ef8eb5d1989062 Mon Sep 17 00:00:00 2001
+From: Edward Lee <edwarddl@google.com>
+Date: Wed, 4 Jan 2023 19:31:17 +0000
 Subject: [PATCH] Links of Memory resource
 
 ObjectMapper association could be created between the motherboard object
@@ -12,7 +12,7 @@
 https://github.com/openbmc/docs/blob/master/architecture/sensor-architecture.md#association-type-1-linking-a-chassis-to-all-sensors-within-the-chassis
 
 Tested:
-Create association between the mothreboard object published by
+Create association between the motherboard object published by
 entity-manger and the system objects (processors, memory, pcie slots)
 published by smbios-mdr.
 
@@ -64,6 +64,7 @@
     }
 }
 
+Signed-off-by: Edward Lee <edwarddl@google.com>
 Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
 Change-Id: I514374e5b8c4fae95c3328f7a87a6ccc194249d5
 
@@ -73,14 +74,14 @@
 Justification: Wait for being approved. Cherry-picked for enabling features.
 
 ---
- redfish-core/lib/memory.hpp | 55 +++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
+ redfish-core/lib/memory.hpp | 57 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 57 insertions(+)
 
 diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
-index 3a63ac3f..ae938d74 100644
+index f34259dc..65788169 100644
 --- a/redfish-core/lib/memory.hpp
 +++ b/redfish-core/lib/memory.hpp
-@@ -760,6 +760,46 @@ class HealthAndPartition :
+@@ -767,6 +767,46 @@ class HealthAndPartition :
          partitionServiceToObjectManagerPath;
      dbus::utility::ManagedObjectType objectsForPartition;
  };
@@ -127,7 +128,7 @@
  } // namespace memory
  
  inline void getAllDimmsCallback(
-@@ -818,6 +858,9 @@ inline void getAllDimmsCallback(
+@@ -825,6 +865,9 @@ inline void getAllDimmsCallback(
          auto dimmHealth = std::make_shared<HealthPopulate>(
              healthAndPartition->asyncResponse, healthPtr);
          dimmHealth->selfPath = objectPath;
@@ -137,22 +138,27 @@
          if (healthAndPartition->health == nullptr)
          {
              dimmHealth->populate();
-@@ -848,6 +891,18 @@ inline void getAllDimmsCallback(
+@@ -855,6 +898,20 @@ inline void getAllDimmsCallback(
              assembleDimmProperties(
                  thisDimmID, healthAndPartition->asyncResponse, properties,
                  healthAndPartition->dimmToPtr[thisDimmID]);
 +            if (interface == "xyz.openbmc_project.Inventory.Connector.Slot")
 +            {
 +                healthAndPartition->asyncResponse->res
-+                    .jsonValue["Location"]["PartLocation"]["LocationType"] =
++                    .jsonValue[healthAndPartition->dimmToPtr[thisDimmID]]
++                              ["Location"]["PartLocation"]["LocationType"] =
 +                    "Slot";
 +            }
 +            if (interface == "xyz.openbmc_project.Inventory.Connector.Embedded")
 +            {
 +                healthAndPartition->asyncResponse->res
-+                    .jsonValue["Location"]["PartLocation"]["LocationType"] =
++                    .jsonValue[healthAndPartition->dimmToPtr[thisDimmID]]
++                              ["Location"]["PartLocation"]["LocationType"] =
 +                    "Embeded";
 +            }
          }
      }
      if (!dimmId)
+-- 
+2.39.0.314.g84b9a713c41-goog
+