* [PATCH] usb: musb: - kill the compile warning
@ 2009-02-06 10:23 Bryan Wu
2009-02-06 18:24 ` Felipe Balbi
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Bryan Wu @ 2009-02-06 10:23 UTC (permalink / raw)
To: felipe.balbi; +Cc: linux-usb, linux-kernel, Bryan Wu, Mike Frysinger
drivers/usb/musb/musb_core.c:1433: warning: assignment makes pointer
from integer without a cast
hw_ep->target_regs = musb_read_target_reg_base(i, mbase);
static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase);
this is a common bug, but a bug still ? mbase is a 32/64 bit pointer,
but we return a u16 to assign to a pointer ? seems odd :)
So return right pointer in the stub.
Cc: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/usb/musb/musb_regs.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index de3b2f1..c2f6a16 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -333,7 +333,7 @@ static inline u16 musb_read_hwvers(void __iomem *mbase)
static inline void __iomem *musb_read_target_reg_base(u8 i, void __iomem *mbase)
{
- return (MUSB_BUSCTL_OFFSET(i, 0) + mbase);
+ return (void __iomem *)(MUSB_BUSCTL_OFFSET(i, 0) + mbase);
}
static inline void musb_write_rxfunaddr(void __iomem *ep_target_regs,
@@ -473,9 +473,9 @@ static inline u16 musb_read_hwvers(void __iomem *mbase)
return 0;
}
-static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase)
+static inline void __iomem *musb_read_target_reg_base(u8 i, void __iomem *mbase)
{
- return 0;
+ return NULL;
}
static inline void musb_write_rxfunaddr(void __iomem *ep_target_regs,
--
1.5.6.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: musb: - kill the compile warning
2009-02-06 10:23 [PATCH] usb: musb: - kill the compile warning Bryan Wu
@ 2009-02-06 18:24 ` Felipe Balbi
2009-02-12 6:03 ` David Brownell
2009-02-25 18:16 ` Felipe Balbi
2 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-02-06 18:24 UTC (permalink / raw)
To: Bryan Wu; +Cc: felipe.balbi, linux-usb, linux-kernel, Mike Frysinger
On Fri, Feb 06, 2009 at 06:23:30PM +0800, Bryan Wu wrote:
> drivers/usb/musb/musb_core.c:1433: warning: assignment makes pointer
> from integer without a cast
> hw_ep->target_regs = musb_read_target_reg_base(i, mbase);
>
> static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase);
>
> this is a common bug, but a bug still ? mbase is a 32/64 bit pointer,
> but we return a u16 to assign to a pointer ? seems odd :)
>
> So return right pointer in the stub.
>
> Cc: Mike Frysinger <vapier.adi@gmail.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> ---
> drivers/usb/musb/musb_regs.h | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
> index de3b2f1..c2f6a16 100644
> --- a/drivers/usb/musb/musb_regs.h
> +++ b/drivers/usb/musb/musb_regs.h
> @@ -333,7 +333,7 @@ static inline u16 musb_read_hwvers(void __iomem *mbase)
>
> static inline void __iomem *musb_read_target_reg_base(u8 i, void __iomem *mbase)
> {
> - return (MUSB_BUSCTL_OFFSET(i, 0) + mbase);
> + return (void __iomem *)(MUSB_BUSCTL_OFFSET(i, 0) + mbase);
please don't cast, we don't get this warning in non-blackfin builds
(well, omap at least)
> @@ -473,9 +473,9 @@ static inline u16 musb_read_hwvers(void __iomem *mbase)
> return 0;
> }
>
> -static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase)
> +static inline void __iomem *musb_read_target_reg_base(u8 i, void __iomem *mbase)
> {
> - return 0;
> + return NULL;
this looks fine
--
balbi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: musb: - kill the compile warning
2009-02-06 10:23 [PATCH] usb: musb: - kill the compile warning Bryan Wu
2009-02-06 18:24 ` Felipe Balbi
@ 2009-02-12 6:03 ` David Brownell
2009-02-12 10:55 ` Felipe Balbi
2009-02-25 18:16 ` Felipe Balbi
2 siblings, 1 reply; 7+ messages in thread
From: David Brownell @ 2009-02-12 6:03 UTC (permalink / raw)
To: Bryan Wu; +Cc: felipe.balbi, linux-usb, linux-kernel, Mike Frysinger
On Friday 06 February 2009, Bryan Wu wrote:
> - return (MUSB_BUSCTL_OFFSET(i, 0) + mbase);
> + return (void __iomem *)(MUSB_BUSCTL_OFFSET(i, 0) + mbase);
Why is MUSB_BUSCTL_OFFSET() returning something other than
an integer? "mbase" is already "void __iomem *", so the only
way that should trigger a warning is if that OFFSET() macro
is doing something odd.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: musb: - kill the compile warning
2009-02-12 6:03 ` David Brownell
@ 2009-02-12 10:55 ` Felipe Balbi
2009-02-12 20:30 ` David Brownell
0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2009-02-12 10:55 UTC (permalink / raw)
To: ext David Brownell
Cc: Bryan Wu, Balbi Felipe (Nokia-D/Helsinki),
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Mike Frysinger
On Thu, Feb 12, 2009 at 07:03:25AM +0100, David Brownell wrote:
> On Friday 06 February 2009, Bryan Wu wrote:
> > - return (MUSB_BUSCTL_OFFSET(i, 0) + mbase);
> > + return (void __iomem *)(MUSB_BUSCTL_OFFSET(i, 0) + mbase);
>
> Why is MUSB_BUSCTL_OFFSET() returning something other than
> an integer? "mbase" is already "void __iomem *", so the only
> way that should trigger a warning is if that OFFSET() macro
> is doing something odd.
The warning only comes on Blackfin's version of this, this hunk is
unnecessary
--
balbi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: musb: - kill the compile warning
2009-02-12 10:55 ` Felipe Balbi
@ 2009-02-12 20:30 ` David Brownell
0 siblings, 0 replies; 7+ messages in thread
From: David Brownell @ 2009-02-12 20:30 UTC (permalink / raw)
To: felipe.balbi
Cc: Bryan Wu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Mike Frysinger
On Thursday 12 February 2009, Felipe Balbi wrote:
> On Thu, Feb 12, 2009 at 07:03:25AM +0100, David Brownell wrote:
> > On Friday 06 February 2009, Bryan Wu wrote:
> > > - return (MUSB_BUSCTL_OFFSET(i, 0) + mbase);
> > > + return (void __iomem *)(MUSB_BUSCTL_OFFSET(i, 0) + mbase);
> >
> > Why is MUSB_BUSCTL_OFFSET() returning something other than
> > an integer? "mbase" is already "void __iomem *", so the only
> > way that should trigger a warning is if that OFFSET() macro
> > is doing something odd.
>
> The warning only comes on Blackfin's version of this, this hunk is
> unnecessary
We want to get rid of Blackfin-specific warnings too ... but
what I was hinting is that this can't be the right fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: musb: - kill the compile warning
2009-02-06 10:23 [PATCH] usb: musb: - kill the compile warning Bryan Wu
2009-02-06 18:24 ` Felipe Balbi
2009-02-12 6:03 ` David Brownell
@ 2009-02-25 18:16 ` Felipe Balbi
2009-02-27 22:37 ` Mike Frysinger
2 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2009-02-25 18:16 UTC (permalink / raw)
To: Bryan Wu; +Cc: felipe.balbi, linux-usb, linux-kernel, Mike Frysinger
On Fri, Feb 06, 2009 at 06:23:30PM +0800, Bryan Wu wrote:
> drivers/usb/musb/musb_core.c:1433: warning: assignment makes pointer
> from integer without a cast
> hw_ep->target_regs = musb_read_target_reg_base(i, mbase);
>
> static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase);
>
> this is a common bug, but a bug still ? mbase is a 32/64 bit pointer,
> but we return a u16 to assign to a pointer ? seems odd :)
>
> So return right pointer in the stub.
>
> Cc: Mike Frysinger <vapier.adi@gmail.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>
any new version coming ??
--
balbi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: musb: - kill the compile warning
2009-02-25 18:16 ` Felipe Balbi
@ 2009-02-27 22:37 ` Mike Frysinger
0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2009-02-27 22:37 UTC (permalink / raw)
To: me; +Cc: Bryan Wu, felipe.balbi, linux-usb, linux-kernel
On Wed, Feb 25, 2009 at 13:16, Felipe Balbi wrote:
> On Fri, Feb 06, 2009 at 06:23:30PM +0800, Bryan Wu wrote:
>> drivers/usb/musb/musb_core.c:1433: warning: assignment makes pointer
>> from integer without a cast
>> hw_ep->target_regs = musb_read_target_reg_base(i, mbase);
>>
>> static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase);
>>
>> this is a common bug, but a bug still ? mbase is a 32/64 bit pointer,
>> but we return a u16 to assign to a pointer ? seems odd :)
>>
>> So return right pointer in the stub.
>>
>> Cc: Mike Frysinger <vapier.adi@gmail.com>
>> Signed-off-by: Bryan Wu <cooloney@kernel.org>
>
> any new version coming ??
so we're all on the same page ...
we agree the first hunk is redundant as MUSB_BUSCTL_OFFSET() is an
integer constant and mbase is of the type that is returned. which
means the first hunk can be dropped.
the 2nd hunk is 100% correct though ...
-mike
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-02-27 22:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 10:23 [PATCH] usb: musb: - kill the compile warning Bryan Wu
2009-02-06 18:24 ` Felipe Balbi
2009-02-12 6:03 ` David Brownell
2009-02-12 10:55 ` Felipe Balbi
2009-02-12 20:30 ` David Brownell
2009-02-25 18:16 ` Felipe Balbi
2009-02-27 22:37 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox