All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: hare@suse.de, jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] scsi: fcoe: Fix implicit type conversion
Date: Tue, 26 Oct 2021 10:14:59 +0000	[thread overview]
Message-ID: <1635243299-2603643-1-git-send-email-jiasheng@iscas.ac.cn> (raw)

The variable 'selected_cpu' is defined as unsigned int.
However in the cpumask_next() it is implicitly type conversed to
int.
It is universally accepted that the implicit type conversion is
terrible.
Also, having the good programming custom will set an example for
others.
Thus, it might be better to change the definition of 'cpu' from
unsigned int to int.

Fixes: 064287e ("[SCSI] fcoe: Round-robin based selection of CPU for post-processing of incoming commands")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/scsi/fcoe/fcoe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 89ec735..2479dc1 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1311,7 +1311,7 @@ static void fcoe_thread_cleanup_local(unsigned int cpu)
  */
 static inline unsigned int fcoe_select_cpu(void)
 {
-	static unsigned int selected_cpu;
+	static int selected_cpu;
 
 	selected_cpu = cpumask_next(selected_cpu, cpu_online_mask);
 	if (selected_cpu >= nr_cpu_ids)
-- 
2.7.4


                 reply	other threads:[~2021-10-26 10:15 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=1635243299-2603643-1-git-send-email-jiasheng@iscas.ac.cn \
    --to=jiasheng@iscas.ac.cn \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.