Skip to contentSkip to conversation

staging: media: sunxi: Add bool cast to value

PATCH Superseded Nishka Dasgupta 2 participants 2 messages Jul 17, 2019 – Jul 18, 2019

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: sunxi: Add bool cast to value

Typecast as bool the return value of cedrus_find_format in cedrus_check_format as the return value of cedrus_check_format is always treated like a boolean value.

---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/sunxi/cedrus/cedrus_video.c +1 -1
index e2b530b1a956..f00a048a0a01 100644
@@ -86,7 +86,7 @@ static struct cedrus_format *cedrus_find_format(u32 pixelformat, u32 directions,
 static bool cedrus_check_format(u32 pixelformat, u32 directions,
 				unsigned int capabilities)
 {
-	return cedrus_find_format(pixelformat, directions, capabilities);
+	return (bool)cedrus_find_format(pixelformat, directions, capabilities);
 }
 
 static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
Signature · 1 line
2.19.1
#1 lore raw

Hi,

Quoted 3 lines · Nishka Dasgupta

Typecast as bool the return value of cedrus_find_format in cedrus_check_format as the return value of cedrus_check_format is always treated like a boolean value.

Thanks for the patch! Could we also add !! to the returned pointer so that we are sure that the function returns either false or true, but never a non-zero value that is not true?

Cheers,

Paul

Quoted 21 lines
---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/sunxi/cedrus/cedrus_video.c +1 -1
index e2b530b1a956..f00a048a0a01 100644
@@ -86,7 +86,7 @@ static struct cedrus_format *cedrus_find_format(u32 pixelformat, u32 directions,
 static bool cedrus_check_format(u32 pixelformat, u32 directions,
 				unsigned int capabilities)
 {
-	return cedrus_find_format(pixelformat, directions, capabilities);
+	return (bool)cedrus_find_format(pixelformat, directions, capabilities);
 }
 
 static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
Signature · 1 line
2.19.1
Signature · 3 lines
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com