Re: [PATCH 6/9] virtio_mmio: Cast resources[1].start to ‘unsigned int *’ to rid compiler warning

2012-11-05 Thread Lee Jones
On Mon, 05 Nov 2012, Rusty Russell wrote:

 Lee Jones lee.jo...@linaro.org writes:
  drivers/virtio/virtio_mmio.c: In function ‘vm_cmdline_set’:
  drivers/virtio/virtio_mmio.c:535:4: warning: format ‘%u’ expects argument 
  of type ‘unsigned int *’, but argument 4 has type ‘resource_size_t *’ 
  [-Wformat]
 
  Cc: Rusty Russell ru...@rustcorp.com.au
  Cc: virtualizat...@lists.linux-foundation.org
  Signed-off-by: Lee Jones lee.jo...@linaro.org
  ---
   drivers/virtio/virtio_mmio.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
  index 6b1b7e1..077e9ca 100644
  --- a/drivers/virtio/virtio_mmio.c
  +++ b/drivers/virtio/virtio_mmio.c
  @@ -531,7 +531,7 @@ static int vm_cmdline_set(const char *device,
  resources[0].end = memparse(device, str) - 1;
   
  processed = sscanf(str, @%lli:%u%n:%d%n,
  -   base, resources[1].start, consumed,
  +   base, (unsigned int *)resources[1].start, consumed,
  vm_cmdline_id, consumed);
 
 This suppresses a valid warning, leaving our code no less wrong than
 before.  But now it's silently wrong!
 
 Do you want to try again?

For sure I'll try again.

How does `s/%u/%p/` suit?

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/9] virtio_mmio: Cast resources[1].start to ‘unsigned int *’ to rid compiler warning

2012-11-05 Thread Pawel Moll
On Mon, 2012-11-05 at 08:21 +, Lee Jones wrote:
 processed = sscanf(str, @%lli:%u%n:%d%n,
   - base, resources[1].start, consumed,
   + base, (unsigned int *)resources[1].start, consumed,
 vm_cmdline_id, consumed);
  
  This suppresses a valid warning, leaving our code no less wrong than
  before.  But now it's silently wrong!
  
  Do you want to try again?
 
 For sure I'll try again.
 
 How does `s/%u/%p/` suit?

sscanf doesn't do %p... The only reasonable way of fixing this is a
intermediate local variable - will post a patch in a second.

Thanks for spotting this!

Paweł


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/9] virtio_mmio: Cast resources[1].start to ‘unsigned int *’ to rid compiler warning

2012-11-04 Thread Rusty Russell
Lee Jones lee.jo...@linaro.org writes:
 drivers/virtio/virtio_mmio.c: In function ‘vm_cmdline_set’:
 drivers/virtio/virtio_mmio.c:535:4: warning: format ‘%u’ expects argument of 
 type ‘unsigned int *’, but argument 4 has type ‘resource_size_t *’ [-Wformat]

 Cc: Rusty Russell ru...@rustcorp.com.au
 Cc: virtualizat...@lists.linux-foundation.org
 Signed-off-by: Lee Jones lee.jo...@linaro.org
 ---
  drivers/virtio/virtio_mmio.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
 index 6b1b7e1..077e9ca 100644
 --- a/drivers/virtio/virtio_mmio.c
 +++ b/drivers/virtio/virtio_mmio.c
 @@ -531,7 +531,7 @@ static int vm_cmdline_set(const char *device,
   resources[0].end = memparse(device, str) - 1;
  
   processed = sscanf(str, @%lli:%u%n:%d%n,
 - base, resources[1].start, consumed,
 + base, (unsigned int *)resources[1].start, consumed,
   vm_cmdline_id, consumed);

This suppresses a valid warning, leaving our code no less wrong than
before.  But now it's silently wrong!

Do you want to try again?

Cheers,
Rusty.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/9] virtio_mmio: Cast resources[1].start to ‘unsigned int *’ to rid compiler warning

2012-11-03 Thread Lee Jones
drivers/virtio/virtio_mmio.c: In function ‘vm_cmdline_set’:
drivers/virtio/virtio_mmio.c:535:4: warning: format ‘%u’ expects argument of 
type ‘unsigned int *’, but argument 4 has type ‘resource_size_t *’ [-Wformat]

Cc: Rusty Russell ru...@rustcorp.com.au
Cc: virtualizat...@lists.linux-foundation.org
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 drivers/virtio/virtio_mmio.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 6b1b7e1..077e9ca 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -531,7 +531,7 @@ static int vm_cmdline_set(const char *device,
resources[0].end = memparse(device, str) - 1;
 
processed = sscanf(str, @%lli:%u%n:%d%n,
-   base, resources[1].start, consumed,
+   base, (unsigned int *)resources[1].start, consumed,
vm_cmdline_id, consumed);
 
if (processed  2 || processed  3 || str[consumed])
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/