[PATCH v2 2/2] drm/ofdrm: Cast error pointers to void __iomem *

Thomas Zimmermann tzimmermann at suse.de
Wed Nov 2 13:43:21 UTC 2022


Hi

Am 02.11.22 um 14:36 schrieb Javier Martinez Canillas:
> Hello Thomas,
> 
> On 10/28/22 14:22, Thomas Zimmermann wrote:
>> Cast error pointers when returning them as void __iomem *. Fixes
>> a number of Sparse warnings, such as the ones shown below.
>>
>> ../drivers/gpu/drm/tiny/ofdrm.c:439:31: warning: incorrect type in return expression (different address spaces)
>> ../drivers/gpu/drm/tiny/ofdrm.c:439:31:    expected void [noderef] __iomem *
>> ../drivers/gpu/drm/tiny/ofdrm.c:439:31:    got void *
>> ../drivers/gpu/drm/tiny/ofdrm.c:442:31: warning: incorrect type in return expression (different address spaces)
>> ../drivers/gpu/drm/tiny/ofdrm.c:442:31:    expected void [noderef] __iomem *
>> ../drivers/gpu/drm/tiny/ofdrm.c:442:31:    got void *
>>
>> See [1] for the bug report.
>>
>> Reported-by: kernel test robot <lkp at intel.com>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> Link: https://lore.kernel.org/dri-devel/202210200016.yiQzPIy0-lkp@intel.com/ # [1]
>> ---
>>   drivers/gpu/drm/tiny/ofdrm.c | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/tiny/ofdrm.c b/drivers/gpu/drm/tiny/ofdrm.c
>> index 44f13a2b372be..f1c301820d54b 100644
>> --- a/drivers/gpu/drm/tiny/ofdrm.c
>> +++ b/drivers/gpu/drm/tiny/ofdrm.c
>> @@ -438,21 +438,21 @@ static void __iomem *get_cmap_address_of(struct ofdrm_device *odev, struct devic
>>   	if (!addr_p)
>>   		addr_p = of_get_address(of_node, bar_no, &max_size, &flags);
>>   	if (!addr_p)
>> -		return ERR_PTR(-ENODEV);
>> +		return (void __iomem *)ERR_PTR(-ENODEV);
>>   
> 
> There's an IOMEM_ERR_PTR() macro already for these cases. If you use
> that instead, feel free to add my r-b when posting v3.

Thanks a lot. I was looking for such a macro and couldn't find it. So 
it's in io.h.

Best regards
Thomas

> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20221102/8e28d7d8/attachment.sig>


More information about the dri-devel mailing list