[PATCH] q35: mch: cleanup MCH_HOST_BRIDGE_F_SMBASE_LCK usage in mch_update_smbase_smram()

Igor Mammedov posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260304114019.2470384-1-imammedo@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/pci-host/q35.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] q35: mch: cleanup MCH_HOST_BRIDGE_F_SMBASE_LCK usage in mch_update_smbase_smram()
Posted by Igor Mammedov 1 month, 1 week ago
evaluate *reg & MCH_HOST_BRIDGE_F_SMBASE_LCK once into lck
and then use lck afterwards.

Suggested-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/pci-host/q35.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index e85e4227b3..8c0404f3c5 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -444,13 +444,13 @@ static void mch_update_smbase_smram(MCHPCIState *mch)
         pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] = MCH_HOST_BRIDGE_F_SMBASE_LCK;
         return;
     }
-    if (*reg & MCH_HOST_BRIDGE_F_SMBASE_LCK) {
+    lck = *reg & MCH_HOST_BRIDGE_F_SMBASE_LCK;
+    if (lck) {
         /* lock register at 0x2 and disable all writes */
         pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] = 0;
         *reg = MCH_HOST_BRIDGE_F_SMBASE_LCK;
     }
 
-    lck = *reg & MCH_HOST_BRIDGE_F_SMBASE_LCK;
     memory_region_transaction_begin();
     memory_region_set_enabled(&mch->smbase_blackhole, lck);
     memory_region_set_enabled(&mch->smbase_window, lck);
-- 
2.47.3