x86: queensbay: Return directly if IGD / SDVO were already disabled
authorBin Meng <bmeng.cn@gmail.com>
Mon, 2 Aug 2021 07:05:15 +0000 (15:05 +0800)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 2 Aug 2021 16:03:14 +0000 (00:03 +0800)
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.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/queensbay/tnc.c

index 782ed863fe7c7038fc70bf9377f2ee6fe27abd68..4a008622d19e33b5d4f9b2a251b4aefdb7e0bb6d 100644 (file)
 
 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;
 
        /*