: hpilo: fix pointer warning in ilo_ccb_setup
PATCH 1/1 : hpilo: fix pointer warning in ilo_ccb_setup
Fixes warning:
drivers/misc/hpilo.c: In function ‘ilo_ccb_setup’:drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different size
drivers/misc/hpilo.c +1 -1
@@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)return -ENOMEM ; dma_va = (char *)data->dma_va; - dma_pa = (char *)data->dma_pa; + dma_pa = (char *)(&data->dma_pa);memset (dma_va,0 , data->dma_size);
Quoted 12 lines · On Fri, 21 May 2010 20:50:41 -0400 Prarit Bhargava <[email protected]> wrote:
Fixes warning:
drivers/misc/hpilo.c: In function___ilo_ccb_setup___:drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different sizeSigned-off-by Prarit Bhargava <[email protected]>drivers/misc/hpilo.c +0
-0
drivers/misc/hpilo.c static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) · line 277
Quoted 7 lines
drivers/misc/hpilo.c +1
-1@@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)return -ENOMEM ; dma_va = (char *)data->dma_va; - dma_pa = (char *)data->dma_pa; + dma_pa = (char *)(&data->dma_pa);memset (dma_va,0 , data->dma_size);
Seems very wrong - writes to *dmp_pa will now scribble over the `struct ccb_data'.
Probably local variable dma_pa should have type dma_addr_t.
Quoted 22 lines · Andrew Morton
Quoted 18 lines · On Fri, 21 May 2010 20:50:41 -0400 Prarit Bhargava<[email protected]> wrote:
Fixes warning:
drivers/misc/hpilo.c: In function___ilo_ccb_setup___:drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different sizeSigned-off-by Prarit Bhargava<[email protected]>drivers/misc/hpilo.c +1
-1@@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)return -ENOMEM ; dma_va = (char *)data->dma_va; - dma_pa = (char *)data->dma_pa; + dma_pa = (char *)(&data->dma_pa);
Quoted 7 lines
drivers/misc/hpilo.c static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) · line 278
Quoted 2 lines
drivers/misc/hpilo.c +0
-0memset (dma_va,0 , data->dma_size);Seems very wrong - writes to
*dmp_pawill now scribble over the `structccb_data'.Probably local variable
dma_pashould have typedma_addr_t.
Ugh ... I even passed this by a colleague at HP :/. I'll fix it up and repost.
P.
I guess it would have helped if I asked David what the code did, first. ":|
-----Original Message-----
From: Prarit Bhargava [mailto:[email protected]]
Sent: Tuesday, May 25, 2010 6:10 PM
To: Andrew Morton
Cc: [email protected]; [email protected]; Altobelli, David; Camuso, Tony
Subject: Re: [PATCH]: hpilo: fix pointer warning in ilo_ccb_setup
Quoted 22 lines · Andrew Morton
Quoted 18 lines · On Fri, 21 May 2010 20:50:41 -0400 Prarit Bhargava<[email protected]> wrote:
Fixes warning:
drivers/misc/hpilo.c: In function___ilo_ccb_setup___:drivers/misc/hpilo.c:274: warning: cast to pointer from integer of different sizeSigned-off-by Prarit Bhargava<[email protected]>drivers/misc/hpilo.c +1
-1@@ -272,7 +272,7 @@ static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)return -ENOMEM ; dma_va = (char *)data->dma_va; - dma_pa = (char *)data->dma_pa; + dma_pa = (char *)(&data->dma_pa);
Quoted 7 lines
drivers/misc/hpilo.c static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) · line 278
Quoted 2 lines
drivers/misc/hpilo.c +0
-0memset (dma_va,0 , data->dma_size);Seems very wrong - writes to
*dmp_pawill now scribble over the `structccb_data'.Probably local variable
dma_pashould have typedma_addr_t.
Ugh ... I even passed this by a colleague at HP :/. I'll fix it up and repost.
P.
Quoted 2 lines
Seems very wrong - writes to
*dmp_pawill now scribble over the `structccb_data'.
Yeah. The dma_pa variable is used to track the physical address of the DMA memory, and it is written to the device. We don't want a kernel pointer, we want the actual physical addr, plus the various offsets.
Quoted 1 line
Probably local variable
dma_pashould have typedma_addr_t.
I feel like I tried that, and I had trouble setting or using the send_fifobar/recv_fifobar variables. But I probably didn't try too hard.