[PATCH] fbdev: mb862xxfb: Use int type to store negative error codes

Qianfeng Rong posted 1 patch 1 month ago
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] fbdev: mb862xxfb: Use int type to store negative error codes
Posted by Qianfeng Rong 1 month ago
Change the 'ret' variable in of_platform_mb862xx_probe() from unsigned long
to int, as it needs to store either negative error codes or zero.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index ade88e7bc760..676c6d3ccc12 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -674,7 +674,7 @@ static int of_platform_mb862xx_probe(struct platform_device *ofdev)
 	struct fb_info *info;
 	struct resource res;
 	resource_size_t res_size;
-	unsigned long ret = -ENODEV;
+	int ret = -ENODEV;
 
 	if (of_address_to_resource(np, 0, &res)) {
 		dev_err(dev, "Invalid address\n");
-- 
2.34.1
Re: [PATCH] fbdev: mb862xxfb: Use int type to store negative error codes
Posted by Helge Deller 2 days, 17 hours ago
On 8/30/25 14:47, Qianfeng Rong wrote:
> Change the 'ret' variable in of_platform_mb862xx_probe() from unsigned long
> to int, as it needs to store either negative error codes or zero.
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but can be confusing. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
>   drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

applied.

Thanks!
Helge