Skip to contentSkip to conversation

perf/x86/intel/uncore: remove dead check

PATCH Applied Jiri Slaby (SUSE) 4 participants 4 messages Nov 19, 2025 – Nov 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/x86/intel/uncore: remove dead check

pmu cannot be NULL as is taken as a pointer to an array. Remove the superfluous NULL check.

Found by Coverity: CID#1497507.

---
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: "Liang, Kan" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 arch/x86/events/intel/uncore.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/events/intel/uncore.c +0 -2
index d6c945cc5d07..e228e564b15e 100644
@@ -1325,8 +1325,6 @@ static void uncore_pci_sub_driver_init(void)
 				continue;
 
 			pmu = &type->pmus[UNCORE_PCI_DEV_IDX(ids->driver_data)];
-			if (!pmu)
-				continue;
 
 			if (uncore_pci_get_dev_die_info(pci_sub_dev, &die))
 				continue;
Signature · 1 line
2.51.1
#1 lore raw

[tip: perf/urgent] perf/x86/intel/uncore: Remove superfluous check

The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     a24074ca8840cf28fa50c40e957fdc50f29971b3
Gitweb:        https://git.kernel.org/tip/a24074ca8840cf28fa50c40e957fdc50f29971b3
Author:        Jiri Slaby (SUSE) <[email protected]>
AuthorDate:    Wed, 19 Nov 2025 10:15:38 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Wed, 19 Nov 2025 10:26:31 +01:00

perf/x86/intel/uncore: Remove superfluous check

The 'pmu' pointer cannot be NULL, as it is taken as a pointer to an array. Remove the superfluous NULL check.

Found by Coverity: CID#1497507.

---
 arch/x86/events/intel/uncore.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/events/intel/uncore.c +0 -2
index d6c945c..e228e56 100644
@@ -1325,8 +1325,6 @@ static void uncore_pci_sub_driver_init(void)
 				continue;
 
 			pmu = &type->pmus[UNCORE_PCI_DEV_IDX(ids->driver_data)];
-			if (!pmu)
-				continue;
 
 			if (uncore_pci_get_dev_die_info(pci_sub_dev, &die))
 				continue;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jiri Slaby (SUSE)
Quoted 32 lines · Jiri Slaby (SUSE)

pmu cannot be NULL as is taken as a pointer to an array. Remove the superfluous NULL check.

Found by Coverity: CID#1497507.

---
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: "Liang, Kan" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 arch/x86/events/intel/uncore.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/events/intel/uncore.c +0 -0
index d6c945cc5d07..e228e564b15e 100644

arch/x86/events/intel/uncore.c static void uncore_pci_sub_driver_init(void) · line 1330

Quoted 8 lines
arch/x86/events/intel/uncore.c +0 -2
@@ -1325,8 +1325,6 @@ static void uncore_pci_sub_driver_init(void)
 				continue;
 
 			pmu = &type->pmus[UNCORE_PCI_DEV_IDX(ids->driver_data)];
-			if (!pmu)
-				continue;
 
 			if (uncore_pci_get_dev_die_info(pci_sub_dev, &die))
 				continue;

LGTM.

reviewer Reviewed-by
#3 lore raw
Quoted 41 lines · Dapeng
Quoted 38 lines · Jiri Slaby (SUSE)

pmu cannot be NULL as is taken as a pointer to an array. Remove the superfluous NULL check.

Found by Coverity: CID#1497507.

---
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: "Liang, Kan" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 arch/x86/events/intel/uncore.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/events/intel/uncore.c +0 -2
index d6c945cc5d07..e228e564b15e 100644
@@ -1325,8 +1325,6 @@ static void uncore_pci_sub_driver_init(void)
                              continue;
 
                      pmu = &type->pmus[UNCORE_PCI_DEV_IDX(ids->driver_data)];
-                     if (!pmu)
-                             continue;
 
Quoted 6 lines

arch/x86/events/intel/uncore.c static void uncore_pci_sub_driver_init(void) · line 1330

Quoted 2 lines
arch/x86/events/intel/uncore.c +0 -0
                      if (uncore_pci_get_dev_die_info(pci_sub_dev, &die))
                              continue;

LGTM.

Thanks,
Ian