Skip to contentSkip to conversation

lib/cpu_rmap: do *_get before using cpu_rmap

PATCH New wuchi 1 participant 1 message Jun 11, 2022 Library code

lore
Share & tools
lore

wuchi

author
#0 lore raw

PATCH 1/1 lib/cpu_rmap: do *_get before using cpu_rmap

It's ok in irq_cpu_rmap_add:

glue->rmap = rmap;
cpu_rmap_get(rmap);

however, it's logically better to do *_get before passing the var..

---
 lib/cpu_rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cpu_rmap.c +1 -1
index f08d9c56f712..590eb544f0d8 100644
@@ -291,8 +291,8 @@ int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq)
 		return -ENOMEM;
 	glue->notify.notify = irq_cpu_rmap_notify;
 	glue->notify.release = irq_cpu_rmap_release;
-	glue->rmap = rmap;
 	cpu_rmap_get(rmap);
+	glue->rmap = rmap;
 	glue->index = cpu_rmap_add(rmap, glue);
 	rc = irq_set_affinity_notifier(irq, &glue->notify);
 	if (rc) {
Signature · 1 line
2.20.1