hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/lib/cpu_rmap.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * cpu_rmap.c: CPU affinity reverse-map support
34 * Copyright 2011 Solarflare Communications Inc.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published
7
- * by the Free Software Foundation, incorporated herein by reference.
85 */
96
107 #include <linux/cpu_rmap.h>
....@@ -235,7 +232,8 @@
235232
236233 for (index = 0; index < rmap->used; index++) {
237234 glue = rmap->obj[index];
238
- irq_set_affinity_notifier(glue->notify.irq, NULL);
235
+ if (glue)
236
+ irq_set_affinity_notifier(glue->notify.irq, NULL);
239237 }
240238
241239 cpu_rmap_put(rmap);
....@@ -258,7 +256,7 @@
258256
259257 rc = cpu_rmap_update(glue->rmap, glue->index, mask);
260258 if (rc)
261
- pr_warning("irq_cpu_rmap_notify: update failed: %d\n", rc);
259
+ pr_warn("irq_cpu_rmap_notify: update failed: %d\n", rc);
262260 }
263261
264262 /**
....@@ -270,6 +268,7 @@
270268 struct irq_glue *glue =
271269 container_of(ref, struct irq_glue, notify.kref);
272270
271
+ glue->rmap->obj[glue->index] = NULL;
273272 cpu_rmap_put(glue->rmap);
274273 kfree(glue);
275274 }
....@@ -300,6 +299,7 @@
300299 rc = irq_set_affinity_notifier(irq, &glue->notify);
301300 if (rc) {
302301 cpu_rmap_put(glue->rmap);
302
+ rmap->obj[glue->index] = NULL;
303303 kfree(glue);
304304 }
305305 return rc;