Initialize 'igd' and 'sdvo' to NULL so that we just need to test
them against NULL later, to be compatible with that case that IGD
and SDVO devices were already in disabled state.

Signed-off-by: Bin Meng <bmeng...@gmail.com>

---

Changes in v2:
- Reword the commit message and add a comment in the codes

 arch/x86/cpu/queensbay/tnc.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
index 782ed863fe..4a008622d1 100644
--- a/arch/x86/cpu/queensbay/tnc.c
+++ b/arch/x86/cpu/queensbay/tnc.c
@@ -18,19 +18,17 @@
 
 static int __maybe_unused disable_igd(void)
 {
-       struct udevice *igd, *sdvo;
+       struct udevice *igd = NULL;
+       struct udevice *sdvo = NULL;
        int ret;
 
-       ret = dm_pci_bus_find_bdf(TNC_IGD, &igd);
-       if (ret)
-               return ret;
-       if (!igd)
-               return 0;
-
-       ret = dm_pci_bus_find_bdf(TNC_SDVO, &sdvo);
-       if (ret)
-               return ret;
-       if (!sdvo)
+       /*
+        * In case the IGD and SDVO devices were already in disabled state,
+        * we should return and not proceed any further.
+        */
+       dm_pci_bus_find_bdf(TNC_IGD, &igd);
+       dm_pci_bus_find_bdf(TNC_SDVO, &sdvo);
+       if (!igd || !sdvo)
                return 0;
 
        /*
-- 
2.25.1

Reply via email to