usb: musb: - kill the compile warning
Subsystems (2)
PATCH 1/1 usb: musb: - kill the compile warning
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.
--- drivers/usb/musb/musb_regs.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_regs.h +3 -3
@@ -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,
Signature · 1 line
1.5.6.3
Quoted 22 lines · Bryan Wu
drivers/usb/musb/musb_core.c:1433: warning: assignment makes pointer from integer without a casthw_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 <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/usb/musb/musb_regs.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)drivers/usb/musb/musb_regs.h +0
-0
drivers/usb/musb/musb_regs.h static inline u16 musb_read_hwvers(void __iomem *mbase) · line 336
Quoted 5 lines
drivers/usb/musb/musb_regs.h +1
-1@@ -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)
drivers/usb/musb/musb_regs.h static inline u16 musb_read_hwvers(void __iomem *mbase) · line 478
Quoted 9 lines
drivers/usb/musb/musb_regs.h +2
-2@@ -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
Signature · 1 line
balbi
Quoted 2 lines · Bryan Wu
- 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.
Quoted 8 lines · David Brownell
drivers/usb/musb/musb_regs.h static inline u16 musb_read_hwvers(void __iomem *mbase) · line 336
Quoted 2 lines · Bryan Wu
drivers/usb/musb/musb_regs.h +1
-1-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 thatOFFSET()macro is doing something odd.
The warning only comes on Blackfin's version of this, this hunk is unnecessary
Signature · 1 line
balbi
Quoted 5 lines · Felipe Balbi
Quoted 4 lines · David Brownell
Quoted 2 lines · Bryan Wu
drivers/usb/musb/musb_regs.h +1
-1-return (MUSB_BUSCTL_OFFSET (i,0 ) + mbase); +return (void __iomem *)(MUSB_BUSCTL_OFFSET (i,0 ) + mbase);
Quoted 7 lines
Quoted 4 lines
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 thatOFFSET()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.
Quoted 6 lines · Bryan Wu
drivers/usb/musb/musb_core.c:1433: warning: assignment makes pointer from integer without a casthw_ep->target_regs = musb_read_target_reg_base(i, mbase);static inline u16
musb_read_target_reg_base(u8 i, void __iomem *mbase);
Quoted 7 lines
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 <[email protected]>Signed-off-by Bryan Wu <[email protected]>
any new version coming ??
Signature · 1 line
balbi
Quoted 10 lines · Felipe Balbi
Quoted 9 lines · Bryan Wu
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 :)
Quoted 6 lines
Quoted 4 lines
So return right pointer in the stub.
Cc Mike Frysinger <[email protected]>Signed-off-by Bryan Wu <[email protected]>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