]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf/x86/uncore: clean up const mismatch
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Dec 2025 12:42:41 +0000 (13:42 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 6 Jan 2026 15:34:23 +0000 (16:34 +0100)
In some cmp functions, a const pointer is cast out to a non-const
pointer by using container_of() which is not correct.  Fix this up by
properly marking the pointers as const, which preserves the correct
type of the pointer passed into the functions.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/2025121741-headstand-stratus-f5eb@gregkh
arch/x86/events/intel/uncore_discovery.c

index 7d57ce706feb1ba5fbd64afae359d6f3e87c11d9..330bca2f14b334db3de6c3a94657e64096308d72 100644 (file)
@@ -52,7 +52,7 @@ static int get_device_die_id(struct pci_dev *dev)
 
 static inline int __type_cmp(const void *key, const struct rb_node *b)
 {
-       struct intel_uncore_discovery_type *type_b = __node_2_type(b);
+       const struct intel_uncore_discovery_type *type_b = __node_2_type(b);
        const u16 *type_id = key;
 
        if (type_b->type > *type_id)
@@ -115,7 +115,7 @@ get_uncore_discovery_type(struct uncore_unit_discovery *unit)
 
 static inline int pmu_idx_cmp(const void *key, const struct rb_node *b)
 {
-       struct intel_uncore_discovery_unit *unit;
+       const struct intel_uncore_discovery_unit *unit;
        const unsigned int *id = key;
 
        unit = rb_entry(b, struct intel_uncore_discovery_unit, node);
@@ -173,7 +173,7 @@ int intel_uncore_find_discovery_unit_id(struct rb_root *units, int die,
 
 static inline bool unit_less(struct rb_node *a, const struct rb_node *b)
 {
-       struct intel_uncore_discovery_unit *a_node, *b_node;
+       const struct intel_uncore_discovery_unit *a_node, *b_node;
 
        a_node = rb_entry(a, struct intel_uncore_discovery_unit, node);
        b_node = rb_entry(b, struct intel_uncore_discovery_unit, node);