diff mbox series

[3/3] lpfc: Fix lpfc_cpumask_of_node_init()

Message ID 20191107052158.25788-6-bvanassche@acm.org (mailing list archive)
State Accepted
Headers show
Series Three lpfc fixes | expand

Commit Message

Bart Van Assche Nov. 7, 2019, 5:21 a.m. UTC
Fix the following kernel warning:

cpumask_of_node(-1): (unsigned)node >= nr_node_ids(1)

Fixes: dcaa21367938 ("scsi: lpfc: Change default IRQ model on AMD architectures")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/lpfc/lpfc_init.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

James Smart Nov. 8, 2019, 10:43 p.m. UTC | #1
On 11/6/2019 9:21 PM, Bart Van Assche wrote:
> Fix the following kernel warning:
> 
> cpumask_of_node(-1): (unsigned)node >= nr_node_ids(1)
> 
> Fixes: dcaa21367938 ("scsi: lpfc: Change default IRQ model on AMD architectures")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/lpfc/lpfc_init.c | 15 ++++-----------
>   1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 37e57fd9ba5d..f2051e2f5f56 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -6005,21 +6005,14 @@ static void
>   lpfc_cpumask_of_node_init(struct lpfc_hba *phba)
>   {
>   	unsigned int cpu, numa_node;
> -	struct cpumask *numa_mask = NULL;
> +	struct cpumask *numa_mask = &phba->sli4_hba.numa_mask;
>   
> -#ifdef CONFIG_NUMA
> -	numa_node = phba->pcidev->dev.numa_node;
> -#else
> -	numa_node = NUMA_NO_NODE;
> -#endif
> -	numa_mask = &phba->sli4_hba.numa_mask;
> +	numa_node = dev_to_node(&phba->pcidev->dev);
> +	if (numa_node == NUMA_NO_NODE)
> +		return;
>   
>   	cpumask_clear(numa_mask);

This patch is good - except that the cpumask_clear needs to be done 
before the return if not numa.

I'll repost with the mod

-- james


>   
> -	/* Check if we're a NUMA architecture */
> -	if (!cpumask_of_node(numa_node))
> -		return;
> -
>   	for_each_possible_cpu(cpu)
>   		if (cpu_to_node(cpu) == numa_node)
>   			cpumask_set_cpu(cpu, numa_mask);
>
Bart Van Assche Nov. 9, 2019, 2:49 a.m. UTC | #2
On 2019-11-08 14:43, James Smart wrote:
> I'll repost with the mod

Thanks!

Bart.
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 37e57fd9ba5d..f2051e2f5f56 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -6005,21 +6005,14 @@  static void
 lpfc_cpumask_of_node_init(struct lpfc_hba *phba)
 {
 	unsigned int cpu, numa_node;
-	struct cpumask *numa_mask = NULL;
+	struct cpumask *numa_mask = &phba->sli4_hba.numa_mask;
 
-#ifdef CONFIG_NUMA
-	numa_node = phba->pcidev->dev.numa_node;
-#else
-	numa_node = NUMA_NO_NODE;
-#endif
-	numa_mask = &phba->sli4_hba.numa_mask;
+	numa_node = dev_to_node(&phba->pcidev->dev);
+	if (numa_node == NUMA_NO_NODE)
+		return;
 
 	cpumask_clear(numa_mask);
 
-	/* Check if we're a NUMA architecture */
-	if (!cpumask_of_node(numa_node))
-		return;
-
 	for_each_possible_cpu(cpu)
 		if (cpu_to_node(cpu) == numa_node)
 			cpumask_set_cpu(cpu, numa_mask);