]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
platform/x86/intel-uncore-freq: Don't present root domain on error
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Mon, 15 Apr 2024 21:52:10 +0000 (14:52 -0700)
committerHans de Goede <hdegoede@redhat.com>
Mon, 29 Apr 2024 08:52:02 +0000 (10:52 +0200)
If none of the clusters are added because of some error, fail to load
driver without presenting root domain. In this case root domain will
present invalid data.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fixes: 01c10f88c9b7 ("platform/x86/intel-uncore-freq: tpmi: Provide cluster level control")
Cc: <stable@vger.kernel.org> # 6.5+
Link: https://lore.kernel.org/r/20240415215210.2824868-1-srinivas.pandruvada@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c

index bd75d61ff8a66196d620b5ca2824d8bb16332237..587437211d722cb0936cb436593960a6b64a252b 100644 (file)
@@ -240,6 +240,7 @@ static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_
        bool read_blocked = 0, write_blocked = 0;
        struct intel_tpmi_plat_info *plat_info;
        struct tpmi_uncore_struct *tpmi_uncore;
+       bool uncore_sysfs_added = false;
        int ret, i, pkg = 0;
        int num_resources;
 
@@ -384,9 +385,15 @@ static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_
                        }
                        /* Point to next cluster offset */
                        cluster_offset >>= UNCORE_MAX_CLUSTER_PER_DOMAIN;
+                       uncore_sysfs_added = true;
                }
        }
 
+       if (!uncore_sysfs_added) {
+               ret = -ENODEV;
+               goto remove_clusters;
+       }
+
        auxiliary_set_drvdata(auxdev, tpmi_uncore);
 
        tpmi_uncore->root_cluster.root_domain = true;