linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix lpfc_parse_bg_err()'s use of do_div()
@ 2009-04-14 15:59 David Howells
  2009-04-14 16:09 ` James Smart
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2009-04-14 15:59 UTC (permalink / raw)
  To: james.smart, linux-scsi; +Cc: dhowells, akpm, linux-kernel

Fix lpfc_parse_bg_err()'s use of do_div().  It should be passing a 64-bit
variable as the first parameter.  However, since it's only using a 32-bit
variable, it doesn't need to use do_div() at all, but can instead use the
division operator.

This deals with the following warnings:

  CC      drivers/scsi/lpfc/lpfc_scsi.o
drivers/scsi/lpfc/lpfc_scsi.c: In function 'lpfc_parse_bg_err':
drivers/scsi/lpfc/lpfc_scsi.c:1397: warning: comparison of distinct pointer types lacks a cast
drivers/scsi/lpfc/lpfc_scsi.c:1397: warning: right shift count >= width of type
drivers/scsi/lpfc/lpfc_scsi.c:1397: warning: passing argument 1 of '__div64_32' from incompatible pointer type

Signed-off-by: David Howells <dhowells@redhat.com>
---

 drivers/scsi/lpfc/lpfc_scsi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index b1bd3fc..36fd2e7 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1394,7 +1394,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 		 */
 		cmd->sense_buffer[8] = 0;     /* Information */
 		cmd->sense_buffer[9] = 0xa;   /* Add. length */
-		do_div(bghm, cmd->device->sector_size);
+		bghm /= cmd->device->sector_size;
 
 		failing_sector = scsi_get_lba(cmd);
 		failing_sector += bghm;

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

* Re: [PATCH] Fix lpfc_parse_bg_err()'s use of do_div()
  2009-04-14 15:59 [PATCH] Fix lpfc_parse_bg_err()'s use of do_div() David Howells
@ 2009-04-14 16:09 ` James Smart
  2009-04-14 16:12   ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: James Smart @ 2009-04-14 16:09 UTC (permalink / raw)
  To: David Howells
  Cc: linux-scsi@vger.kernel.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org

David,

I already posted the same fix on 4/7. See:
http://marc.info/?l=linux-scsi&m=123912745216961&w=2

-- james s

David Howells wrote:
> Fix lpfc_parse_bg_err()'s use of do_div().  It should be passing a 64-bit
> variable as the first parameter.  However, since it's only using a 32-bit
> variable, it doesn't need to use do_div() at all, but can instead use the
> division operator.
>
> This deals with the following warnings:
>
>   CC      drivers/scsi/lpfc/lpfc_scsi.o
> drivers/scsi/lpfc/lpfc_scsi.c: In function 'lpfc_parse_bg_err':
> drivers/scsi/lpfc/lpfc_scsi.c:1397: warning: comparison of distinct pointer types lacks a cast
> drivers/scsi/lpfc/lpfc_scsi.c:1397: warning: right shift count >= width of type
> drivers/scsi/lpfc/lpfc_scsi.c:1397: warning: passing argument 1 of '__div64_32' from incompatible pointer type
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
>
>  drivers/scsi/lpfc/lpfc_scsi.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
>
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
> index b1bd3fc..36fd2e7 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -1394,7 +1394,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
>  		 */
>  		cmd->sense_buffer[8] = 0;     /* Information */
>  		cmd->sense_buffer[9] = 0xa;   /* Add. length */
> -		do_div(bghm, cmd->device->sector_size);
> +		bghm /= cmd->device->sector_size;
>  
>  		failing_sector = scsi_get_lba(cmd);
>  		failing_sector += bghm;
>
>   

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

* Re: [PATCH] Fix lpfc_parse_bg_err()'s use of do_div()
  2009-04-14 16:09 ` James Smart
@ 2009-04-14 16:12   ` David Howells
  0 siblings, 0 replies; 3+ messages in thread
From: David Howells @ 2009-04-14 16:12 UTC (permalink / raw)
  To: James Smart
  Cc: dhowells, linux-scsi@vger.kernel.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org

James Smart <James.Smart@Emulex.Com> wrote:

> I already posted the same fix on 4/7. See:
> http://marc.info/?l=linux-scsi&m=123912745216961&w=2

Fair enough.  Feel free to add my Acked-by.

David

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

end of thread, other threads:[~2009-04-14 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 15:59 [PATCH] Fix lpfc_parse_bg_err()'s use of do_div() David Howells
2009-04-14 16:09 ` James Smart
2009-04-14 16:12   ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).