]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - lib/devres.c
lib/devres.c: fix some sparse warnings
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 3 Apr 2014 21:49:07 +0000 (14:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Apr 2014 23:21:11 +0000 (16:21 -0700)
commitb104d6a5a82a56dbba8f743144e21d63ad181773
treed01d7aa185238f55fc223ea14ef612ccc8fd17c6
parent3d8e4b401cdf6fcfdd1a897f585c88afc2e386c7
lib/devres.c: fix some sparse warnings

Having a discussion about sparse warnings in the kernel, and that we
should clean them up, I decided to pick a random file to do so.  This
happened to be devres.c which gives the following warnings:

    CHECK   lib/devres.c
  lib/devres.c:83:9: warning: cast removes address space of expression
  lib/devres.c:117:31: warning: incorrect type in return expression (different address spaces)
  lib/devres.c:117:31:    expected void [noderef] <asn:2>*
  lib/devres.c:117:31:    got void *
  lib/devres.c:125:31: warning: incorrect type in return expression (different address spaces)
  lib/devres.c:125:31:    expected void [noderef] <asn:2>*
  lib/devres.c:125:31:    got void *
  lib/devres.c:136:26: warning: incorrect type in assignment (different address spaces)
  lib/devres.c:136:26:    expected void [noderef] <asn:2>*[assigned] dest_ptr
  lib/devres.c:136:26:    got void *
  lib/devres.c:226:9: warning: cast removes address space of expression

Mostly it's just the use of typecasting to void * without adding
__force, or returning ERR_PTR(-ESOMEERR) without typecasting to a
__iomem type.

I added a helper macro IOMEM_ERR_PTR() that does the typecast to make
the code a little nicer than adding ugly typecasts to the code.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/devres.c