| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * cpu_rmap.c: CPU affinity reverse-map support |
|---|
| 3 | 4 | * 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. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/cpu_rmap.h> |
|---|
| .. | .. |
|---|
| 235 | 232 | |
|---|
| 236 | 233 | for (index = 0; index < rmap->used; index++) { |
|---|
| 237 | 234 | 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); |
|---|
| 239 | 237 | } |
|---|
| 240 | 238 | |
|---|
| 241 | 239 | cpu_rmap_put(rmap); |
|---|
| .. | .. |
|---|
| 258 | 256 | |
|---|
| 259 | 257 | rc = cpu_rmap_update(glue->rmap, glue->index, mask); |
|---|
| 260 | 258 | 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); |
|---|
| 262 | 260 | } |
|---|
| 263 | 261 | |
|---|
| 264 | 262 | /** |
|---|
| .. | .. |
|---|
| 270 | 268 | struct irq_glue *glue = |
|---|
| 271 | 269 | container_of(ref, struct irq_glue, notify.kref); |
|---|
| 272 | 270 | |
|---|
| 271 | + glue->rmap->obj[glue->index] = NULL; |
|---|
| 273 | 272 | cpu_rmap_put(glue->rmap); |
|---|
| 274 | 273 | kfree(glue); |
|---|
| 275 | 274 | } |
|---|
| .. | .. |
|---|
| 300 | 299 | rc = irq_set_affinity_notifier(irq, &glue->notify); |
|---|
| 301 | 300 | if (rc) { |
|---|
| 302 | 301 | cpu_rmap_put(glue->rmap); |
|---|
| 302 | + rmap->obj[glue->index] = NULL; |
|---|
| 303 | 303 | kfree(glue); |
|---|
| 304 | 304 | } |
|---|
| 305 | 305 | return rc; |
|---|