On Saturday, June 28, 2014 3:31 AM, Paul Zimmerman wrote: > On Friday, June 27, 2014 11:00 AM, Sergei Shtylyov wrote: > > On 06/27/2014 07:09 PM, dinguyen@xxxxxxxxxx wrote: > > > >> From: Dinh Nguyen <dinguyen@xxxxxxxxxx> > > > >> This patch fixes this sparse warning: > > > >> drivers/usb/dwc2/platform.c:168:25: warning: incorrect type in argument 1 (different address spaces) > >> drivers/usb/dwc2/platform.c:168:25: expected void const *ptr > >> drivers/usb/dwc2/platform.c:168:25: got void [noderef] <asn:2>*regs > >> drivers/usb/dwc2/platform.c:169:37: warning: incorrect type in argument 1 (different address spaces) > >> drivers/usb/dwc2/platform.c:169:37: expected void const *ptr > >> drivers/usb/dwc2/platform.c:169:37: got void [noderef] <asn:2>*regs > > > >> Signed-off-by: Dinh Nguyen <dinguyen@xxxxxxxxxx> > >> --- > >> drivers/usb/dwc2/platform.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > > > >> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > >> index a10e7a3..443c321 100644 > >> --- a/drivers/usb/dwc2/platform.c > >> +++ b/drivers/usb/dwc2/platform.c > >> @@ -165,8 +165,8 @@ static int dwc2_driver_probe(struct platform_device *dev) > >> > >> res = platform_get_resource(dev, IORESOURCE_MEM, 0); > >> hsotg->regs = devm_ioremap_resource(&dev->dev, res); > >> - if (IS_ERR(hsotg->regs)) > >> - return PTR_ERR(hsotg->regs); > >> + if (!hsotg->regs) > >> + return -ENOMEM; > > > > This is wrong -- devm_ioremap_resource() returns error pointer, not NULL. > > Yup. Sparse gives the same warnings on other drivers as well, like dwc3 > and musb. Maybe there is a newer version of sparse which fixes this? Or > does the definition of IS_ERR need some work? As far as I know, the following patch was merged last year, in order to silence these sparse warnings. commit e7152b9 "err.h: IS_ERR() can accept __user pointers" In addition, the Sparse should be upgraded to v0.4.5-rc1 or later. Thank you. Best regards, Jingoo Han > > -- > Paul -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html