All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] megaraid_sas: Fix the search of first memory bar
@ 2016-08-21  8:28 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2016-08-21  8:28 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, uday.lingala, jejb, martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	Christophe JAILLET

The 2nd parameter of 'find_first_bit' is the number of bits to search.
In this case, we are passing 'sizeof(unsigned long)' which is likely to
be 4.

It is likely that the number of bits in a long was expected here, so use
BITS_PER_LONG instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Other options are possible:
  - 'bar_list' being a 'unsigned long', use __ffs to reduce code verbosity
  - PCI_NUM_RESOURCES, which is the maximum number of bits that can be set
    by 'pci_select_bars()'
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index c1ed25adb17e..7d3de811d33c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5036,7 +5036,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 
 	/* Find first memory bar */
 	bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
-	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
+	instance->bar = find_first_bit(&bar_list, BITS_PER_LONG);
 	if (pci_request_selected_regions(instance->pdev, 1<<instance->bar,
 					 "megasas: LSI")) {
 		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory region busy!\n");
-- 
2.7.4


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] megaraid_sas: Fix the search of first memory bar
@ 2016-08-21  8:28 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2016-08-21  8:28 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, uday.lingala, jejb, martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	Christophe JAILLET

The 2nd parameter of 'find_first_bit' is the number of bits to search.
In this case, we are passing 'sizeof(unsigned long)' which is likely to
be 4.

It is likely that the number of bits in a long was expected here, so use
BITS_PER_LONG instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Other options are possible:
  - 'bar_list' being a 'unsigned long', use __ffs to reduce code verbosity
  - PCI_NUM_RESOURCES, which is the maximum number of bits that can be set
    by 'pci_select_bars()'
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index c1ed25adb17e..7d3de811d33c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5036,7 +5036,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 
 	/* Find first memory bar */
 	bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
-	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
+	instance->bar = find_first_bit(&bar_list, BITS_PER_LONG);
 	if (pci_request_selected_regions(instance->pdev, 1<<instance->bar,
 					 "megasas: LSI")) {
 		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory region busy!\n");
-- 
2.7.4


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] megaraid_sas: Fix the search of first memory bar
  2016-08-21  8:28 ` Christophe JAILLET
@ 2016-08-26  2:30   ` Martin K. Petersen
  -1 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2016-08-26  2:30 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kashyap.desai, sumit.saxena, uday.lingala, jejb, martin.petersen,
	megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors

>>>>> "Christophe" == Christophe JAILLET <christophe.jaillet@wanadoo.fr> writes:

Christophe> The 2nd parameter of 'find_first_bit' is the number of bits
Christophe> to search.  In this case, we are passing 'sizeof(unsigned
Christophe> long)' which is likely to be 4.

Kashyap? Sumit?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] megaraid_sas: Fix the search of first memory bar
@ 2016-08-26  2:30   ` Martin K. Petersen
  0 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2016-08-26  2:30 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kashyap.desai, sumit.saxena, uday.lingala, jejb, martin.petersen,
	megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors

>>>>> "Christophe" = Christophe JAILLET <christophe.jaillet@wanadoo.fr> writes:

Christophe> The 2nd parameter of 'find_first_bit' is the number of bits
Christophe> to search.  In this case, we are passing 'sizeof(unsigned
Christophe> long)' which is likely to be 4.

Kashyap? Sumit?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] megaraid_sas: Fix the search of first memory bar
  2016-08-21  8:28 ` Christophe JAILLET
@ 2016-08-26  4:13   ` Sumit Saxena
  -1 siblings, 0 replies; 8+ messages in thread
From: Sumit Saxena @ 2016-08-26  4:01 UTC (permalink / raw)
  To: Christophe JAILLET, kashyap.desai, sumit.saxena, uday.lingala,
	jejb, martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors

>-----Original Message-----
>From: Christophe JAILLET [mailto:christophe.jaillet@wanadoo.fr]
>Sent: Sunday, August 21, 2016 1:58 PM
>To: kashyap.desai@avagotech.com; sumit.saxena@avagotech.com;
>uday.lingala@avagotech.com; jejb@linux.vnet.ibm.com;
>martin.petersen@oracle.com
>Cc: megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org; linux-
>kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Christophe JAILLET
>Subject: [PATCH] megaraid_sas: Fix the search of first memory bar
>
>The 2nd parameter of 'find_first_bit' is the number of bits to search.
>In this case, we are passing 'sizeof(unsigned long)' which is likely to be
>4.
>
>It is likely that the number of bits in a long was expected here, so use
>BITS_PER_LONG instead.
>
>Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>---
>Other options are possible:
>  - 'bar_list' being a 'unsigned long', use __ffs to reduce code verbosity
>  - PCI_NUM_RESOURCES, which is the maximum number of bits that can be set
>    by 'pci_select_bars()'
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25adb17e..7d3de811d33c 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -5036,7 +5036,7 @@ static int megasas_init_fw(struct megasas_instance
>*instance)
>
> 	/* Find first memory bar */
> 	bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
>-	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
>+	instance->bar = find_first_bit(&bar_list, BITS_PER_LONG);
> 	if (pci_request_selected_regions(instance->pdev, 1<<instance->bar,
> 					 "megasas: LSI")) {
> 		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory
>region busy!\n");

Acked by: Sumit Saxena <sumit.saxena@broadcom.com>

>--
>2.7.4
>
>
>---
>L'absence de virus dans ce courrier électronique a été vérifiée par le
>logiciel
>antivirus Avast.
>https://www.avast.com/antivirus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] megaraid_sas: Fix the search of first memory bar
@ 2016-08-26  4:13   ` Sumit Saxena
  0 siblings, 0 replies; 8+ messages in thread
From: Sumit Saxena @ 2016-08-26  4:13 UTC (permalink / raw)
  To: Christophe JAILLET, kashyap.desai, sumit.saxena, uday.lingala,
	jejb, martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors

>-----Original Message-----
>From: Christophe JAILLET [mailto:christophe.jaillet@wanadoo.fr]
>Sent: Sunday, August 21, 2016 1:58 PM
>To: kashyap.desai@avagotech.com; sumit.saxena@avagotech.com;
>uday.lingala@avagotech.com; jejb@linux.vnet.ibm.com;
>martin.petersen@oracle.com
>Cc: megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org; linux-
>kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Christophe JAILLET
>Subject: [PATCH] megaraid_sas: Fix the search of first memory bar
>
>The 2nd parameter of 'find_first_bit' is the number of bits to search.
>In this case, we are passing 'sizeof(unsigned long)' which is likely to be
>4.
>
>It is likely that the number of bits in a long was expected here, so use
>BITS_PER_LONG instead.
>
>Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>---
>Other options are possible:
>  - 'bar_list' being a 'unsigned long', use __ffs to reduce code verbosity
>  - PCI_NUM_RESOURCES, which is the maximum number of bits that can be set
>    by 'pci_select_bars()'
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25adb17e..7d3de811d33c 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -5036,7 +5036,7 @@ static int megasas_init_fw(struct megasas_instance
>*instance)
>
> 	/* Find first memory bar */
> 	bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
>-	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
>+	instance->bar = find_first_bit(&bar_list, BITS_PER_LONG);
> 	if (pci_request_selected_regions(instance->pdev, 1<<instance->bar,
> 					 "megasas: LSI")) {
> 		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory
>region busy!\n");

Acked by: Sumit Saxena <sumit.saxena@broadcom.com>

>--
>2.7.4
>
>
>---
>L'absence de virus dans ce courrier électronique a été vérifiée par le
>logiciel
>antivirus Avast.
>https://www.avast.com/antivirus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] megaraid_sas: Fix the search of first memory bar
  2016-08-21  8:28 ` Christophe JAILLET
@ 2016-08-31  2:23   ` Martin K. Petersen
  -1 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2016-08-31  2:23 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kashyap.desai, sumit.saxena, uday.lingala, jejb, martin.petersen,
	megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors

>>>>> "Christophe" == Christophe JAILLET <christophe.jaillet@wanadoo.fr> writes:

Christophe> The 2nd parameter of 'find_first_bit' is the number of bits
Christophe> to search.  In this case, we are passing 'sizeof(unsigned
Christophe> long)' which is likely to be 4.

Christophe> It is likely that the number of bits in a long was expected
Christophe> here, so use BITS_PER_LONG instead.

Applied to 4.9/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] megaraid_sas: Fix the search of first memory bar
@ 2016-08-31  2:23   ` Martin K. Petersen
  0 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2016-08-31  2:23 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kashyap.desai, sumit.saxena, uday.lingala, jejb, martin.petersen,
	megaraidlinux.pdl, linux-scsi, linux-kernel, kernel-janitors

>>>>> "Christophe" = Christophe JAILLET <christophe.jaillet@wanadoo.fr> writes:

Christophe> The 2nd parameter of 'find_first_bit' is the number of bits
Christophe> to search.  In this case, we are passing 'sizeof(unsigned
Christophe> long)' which is likely to be 4.

Christophe> It is likely that the number of bits in a long was expected
Christophe> here, so use BITS_PER_LONG instead.

Applied to 4.9/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-08-31  2:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-21  8:28 [PATCH] megaraid_sas: Fix the search of first memory bar Christophe JAILLET
2016-08-21  8:28 ` Christophe JAILLET
2016-08-26  2:30 ` Martin K. Petersen
2016-08-26  2:30   ` Martin K. Petersen
2016-08-26  4:01 ` Sumit Saxena
2016-08-26  4:13   ` Sumit Saxena
2016-08-31  2:23 ` Martin K. Petersen
2016-08-31  2:23   ` Martin K. Petersen

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.