diff mbox

[2/2] video: clps711x: Fix sparse warnings

Message ID 1403937246-14506-2-git-send-email-shc_work@mail.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Shiyan June 28, 2014, 6:34 a.m. UTC
This patch fixes below warnings:
CHECK   drivers/video/fbdev/clps711x-fb.c
  drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
  drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
  drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
  drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
  drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
  drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
  drivers/video/fbdev/clps711x-fb.c:314:17: warning: incorrect type in initializer (different address spaces)
  drivers/video/fbdev/clps711x-fb.c:314:17:    expected void *__p
  drivers/video/fbdev/clps711x-fb.c:314:17:    got char [noderef] <asn:2>*screen_base
CC [M]  drivers/video/fbdev/clps711x-fb.o

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/video/fbdev/clps711x-fb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Tomi Valkeinen July 1, 2014, 6:14 a.m. UTC | #1
On 28/06/14 09:34, Alexander Shiyan wrote:
> This patch fixes below warnings:
> CHECK   drivers/video/fbdev/clps711x-fb.c
>   drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
>   drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
>   drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
>   drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
>   drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
>   drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
>   drivers/video/fbdev/clps711x-fb.c:314:17: warning: incorrect type in initializer (different address spaces)
>   drivers/video/fbdev/clps711x-fb.c:314:17:    expected void *__p
>   drivers/video/fbdev/clps711x-fb.c:314:17:    got char [noderef] <asn:2>*screen_base
> CC [M]  drivers/video/fbdev/clps711x-fb.o
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/video/fbdev/clps711x-fb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
> index 4d17fbb..bbf40fe 100644
> --- a/drivers/video/fbdev/clps711x-fb.c
> +++ b/drivers/video/fbdev/clps711x-fb.c
> @@ -244,8 +244,8 @@ static int clps711x_fb_probe(struct platform_device *pdev)
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  	info->screen_base = devm_ioremap_resource(dev, res);
> -	if (IS_ERR(info->screen_base)) {
> -		ret = PTR_ERR(info->screen_base);
> +	if (IS_ERR((__force void *)info->screen_base)) {
> +		ret = PTR_ERR((__force void *)info->screen_base);

I don't see any other user of devm_ioremap_resource() having that kind
of casts. Why are they needed here?

 Tomi
Alexander Shiyan July 1, 2014, 6:23 a.m. UTC | #2
Tue, 1 Jul 2014 09:14:02 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
> On 28/06/14 09:34, Alexander Shiyan wrote:
> > This patch fixes below warnings:
> > CHECK   drivers/video/fbdev/clps711x-fb.c
> >   drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
> >   drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
> >   drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
> >   drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
> >   drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
> >   drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
...
> >  	info->screen_base = devm_ioremap_resource(dev, res);
> > -	if (IS_ERR(info->screen_base)) {
> > -		ret = PTR_ERR(info->screen_base);
> > +	if (IS_ERR((__force void *)info->screen_base)) {
> > +		ret = PTR_ERR((__force void *)info->screen_base);
> 
> I don't see any other user of devm_ioremap_resource() having that kind
> of casts. Why are they needed here?

Not needed, type cast was done only to remove sparse warnings.

---
Tomi Valkeinen July 1, 2014, 10:22 a.m. UTC | #3
On 01/07/14 09:23, Alexander Shiyan wrote:
> Tue, 1 Jul 2014 09:14:02 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
>> On 28/06/14 09:34, Alexander Shiyan wrote:
>>> This patch fixes below warnings:
>>> CHECK   drivers/video/fbdev/clps711x-fb.c
>>>   drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
>>>   drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
>>>   drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
>>>   drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
>>>   drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
>>>   drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
> ...
>>>  	info->screen_base = devm_ioremap_resource(dev, res);
>>> -	if (IS_ERR(info->screen_base)) {
>>> -		ret = PTR_ERR(info->screen_base);
>>> +	if (IS_ERR((__force void *)info->screen_base)) {
>>> +		ret = PTR_ERR((__force void *)info->screen_base);
>>
>> I don't see any other user of devm_ioremap_resource() having that kind
>> of casts. Why are they needed here?
> 
> Not needed, type cast was done only to remove sparse warnings.

Right, but I think either sparse is wrong here, or the PTR_ERR/IS_ERR
are wrong. You shouldn't do typecasts like that to hide those warnings.

The memset warning is correct, because you shouldn't use memset to
__iomem memory.

 Tomi
Alexander Shiyan July 1, 2014, 10:31 a.m. UTC | #4
Tue, 1 Jul 2014 13:22:51 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
> On 01/07/14 09:23, Alexander Shiyan wrote:
> > Tue, 1 Jul 2014 09:14:02 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
> >> On 28/06/14 09:34, Alexander Shiyan wrote:
> >>> This patch fixes below warnings:
> >>> CHECK   drivers/video/fbdev/clps711x-fb.c
> >>>   drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
> >>>   drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
> >>>   drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
> >>>   drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
> >>>   drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
> >>>   drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
> > ...
> >>>  	info->screen_base = devm_ioremap_resource(dev, res);
> >>> -	if (IS_ERR(info->screen_base)) {
> >>> -		ret = PTR_ERR(info->screen_base);
> >>> +	if (IS_ERR((__force void *)info->screen_base)) {
> >>> +		ret = PTR_ERR((__force void *)info->screen_base);
> >>
> >> I don't see any other user of devm_ioremap_resource() having that kind
> >> of casts. Why are they needed here?
> > 
> > Not needed, type cast was done only to remove sparse warnings.
> 
> Right, but I think either sparse is wrong here, or the PTR_ERR/IS_ERR
> are wrong. You shouldn't do typecasts like that to hide those warnings.

Well, I'll remove these changes and send a second version of the patch.

---
Tomi Valkeinen July 4, 2014, 8:06 a.m. UTC | #5
Hi,

On 01/07/14 13:31, Alexander Shiyan wrote:
> Tue, 1 Jul 2014 13:22:51 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
>> On 01/07/14 09:23, Alexander Shiyan wrote:
>>> Tue, 1 Jul 2014 09:14:02 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>> On 28/06/14 09:34, Alexander Shiyan wrote:
>>>>> This patch fixes below warnings:
>>>>> CHECK   drivers/video/fbdev/clps711x-fb.c
>>>>>   drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
>>>>>   drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
>>>>>   drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
>>>>>   drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
>>>>>   drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
>>>>>   drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
>>> ...
>>>>>  	info->screen_base = devm_ioremap_resource(dev, res);
>>>>> -	if (IS_ERR(info->screen_base)) {
>>>>> -		ret = PTR_ERR(info->screen_base);
>>>>> +	if (IS_ERR((__force void *)info->screen_base)) {
>>>>> +		ret = PTR_ERR((__force void *)info->screen_base);
>>>>
>>>> I don't see any other user of devm_ioremap_resource() having that kind
>>>> of casts. Why are they needed here?
>>>
>>> Not needed, type cast was done only to remove sparse warnings.
>>
>> Right, but I think either sparse is wrong here, or the PTR_ERR/IS_ERR
>> are wrong. You shouldn't do typecasts like that to hide those warnings.
> 
> Well, I'll remove these changes and send a second version of the patch.

I applied these two patches, and removed the type casts from the second one.

 Tomi
Alexander Shiyan July 4, 2014, 8:35 a.m. UTC | #6
Fri, 4 Jul 2014 11:06:31 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
> On 01/07/14 13:31, Alexander Shiyan wrote:
> > Tue, 1 Jul 2014 13:22:51 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
> >> On 01/07/14 09:23, Alexander Shiyan wrote:
> >>> Tue, 1 Jul 2014 09:14:02 +0300 ?? Tomi Valkeinen <tomi.valkeinen@ti.com>:
> >>>> On 28/06/14 09:34, Alexander Shiyan wrote:
> >>>>> This patch fixes below warnings:
> >>>>> CHECK   drivers/video/fbdev/clps711x-fb.c
> >>>>>   drivers/video/fbdev/clps711x-fb.c:247:24: warning: incorrect type in argument 1 (different address spaces)
> >>>>>   drivers/video/fbdev/clps711x-fb.c:247:24:    expected void const *ptr
> >>>>>   drivers/video/fbdev/clps711x-fb.c:247:24:    got char [noderef] <asn:2>*screen_base
> >>>>>   drivers/video/fbdev/clps711x-fb.c:248:35: warning: incorrect type in argument 1 (different address spaces)
> >>>>>   drivers/video/fbdev/clps711x-fb.c:248:35:    expected void const *ptr
> >>>>>   drivers/video/fbdev/clps711x-fb.c:248:35:    got char [noderef] <asn:2>*screen_base
> >>> ...
> >>>>>  	info->screen_base = devm_ioremap_resource(dev, res);
> >>>>> -	if (IS_ERR(info->screen_base)) {
> >>>>> -		ret = PTR_ERR(info->screen_base);
> >>>>> +	if (IS_ERR((__force void *)info->screen_base)) {
> >>>>> +		ret = PTR_ERR((__force void *)info->screen_base);
> >>>>
> >>>> I don't see any other user of devm_ioremap_resource() having that kind
> >>>> of casts. Why are they needed here?
> >>>
> >>> Not needed, type cast was done only to remove sparse warnings.
> >>
> >> Right, but I think either sparse is wrong here, or the PTR_ERR/IS_ERR
> >> are wrong. You shouldn't do typecasts like that to hide those warnings.
> > 
> > Well, I'll remove these changes and send a second version of the patch.
> 
> I applied these two patches, and removed the type casts from the second one.

OK, Thanks!

---
diff mbox

Patch

diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
index 4d17fbb..bbf40fe 100644
--- a/drivers/video/fbdev/clps711x-fb.c
+++ b/drivers/video/fbdev/clps711x-fb.c
@@ -244,8 +244,8 @@  static int clps711x_fb_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	info->screen_base = devm_ioremap_resource(dev, res);
-	if (IS_ERR(info->screen_base)) {
-		ret = PTR_ERR(info->screen_base);
+	if (IS_ERR((__force void *)info->screen_base)) {
+		ret = PTR_ERR((__force void *)info->screen_base);
 		goto out_fb_release;
 	}
 
@@ -311,7 +311,7 @@  static int clps711x_fb_probe(struct platform_device *pdev)
 		/* Setup start FB address */
 		writeb(info->fix.smem_start >> 28, cfb->base + CLPS711X_FBADDR);
 		/* Clean FB memory */
-		memset(info->screen_base, 0, cfb->buffsize);
+		memset_io(info->screen_base, 0, cfb->buffsize);
 	}
 
 	cfb->lcd_pwr = devm_regulator_get(dev, "lcd");