public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wuchi <wuchi.zero@gmail.com>
To: bhutchings@solarflare.com, decot@googlers.com, info@metux.net,
	josh@joshtriplett.org
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] lib/cpu_rmap: do *_get before using cpu_rmap
Date: Sat, 11 Jun 2022 16:09:04 +0800	[thread overview]
Message-ID: <20220611080904.92120-1-wuchi.zero@gmail.com> (raw)

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..

Signed-off-by: wuchi <wuchi.zero@gmail.com>
---
 lib/cpu_rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cpu_rmap.c b/lib/cpu_rmap.c
index f08d9c56f712..590eb544f0d8 100644
--- a/lib/cpu_rmap.c
+++ b/lib/cpu_rmap.c
@@ -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) {
-- 
2.20.1


                 reply	other threads:[~2022-06-11  8:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220611080904.92120-1-wuchi.zero@gmail.com \
    --to=wuchi.zero@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhutchings@solarflare.com \
    --cc=decot@googlers.com \
    --cc=info@metux.net \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox