Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
* [PATCH] src: gen-image: Fix compiler warning
@ 2026-09-17 10:19 Paul Elder
  2026-09-17 21:07 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Elder @ 2026-09-17 10:19 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: laurent.pinchart, Paul Elder

Fix compiler warning for maybe uninitialized.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/gen-image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gen-image.c b/src/gen-image.c
index 26d7f0d28417..401e1316ae5a 100644
--- a/src/gen-image.c
+++ b/src/gen-image.c
@@ -386,7 +386,7 @@ static int pnm_read_integer(int fd)
 
 static struct image *pnm_read(const char *filename)
 {
-	struct image *image;
+	struct image *image = NULL;
 	unsigned int width;
 	unsigned int height;
 	char buffer[2];
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] src: gen-image: Fix compiler warning
  2026-09-17 10:19 [PATCH] src: gen-image: Fix compiler warning Paul Elder
@ 2026-09-17 21:07 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2026-09-17 21:07 UTC (permalink / raw)
  To: Paul Elder; +Cc: linux-renesas-soc

Hi Paul,

Thank you for the patch.

On Thu, Sep 17, 2026 at 07:19:12PM +0900, Paul Elder wrote:
> Fix compiler warning for maybe uninitialized.

It's useful to record more detailed information when working around
compiler issues. I'll expand the commit message to


gcc reports an uninitialized variable when compiling with '-Os':

In function ‘process’,
    inlined from ‘main’ at ../src/gen-image.c:2359:8:
../src/gen-image.c:1722:12: error: ‘image’ may be used uninitialized [-Werror=maybe-uninitialized]
 1722 |         if (!input) {
      |            ^
../src/gen-image.c: In function ‘main’:
../src/gen-image.c:389:23: note: ‘image’ was declared here
  389 |         struct image *image;
      |                       ^~~~~

This appears to be a false positive. Work around it by initializing the
image variable to NULL when declaring it.

> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  src/gen-image.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gen-image.c b/src/gen-image.c
> index 26d7f0d28417..401e1316ae5a 100644
> --- a/src/gen-image.c
> +++ b/src/gen-image.c
> @@ -386,7 +386,7 @@ static int pnm_read_integer(int fd)
>  
>  static struct image *pnm_read(const char *filename)
>  {
> -	struct image *image;
> +	struct image *image = NULL;
>  	unsigned int width;
>  	unsigned int height;
>  	char buffer[2];

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-17 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 10:19 [PATCH] src: gen-image: Fix compiler warning Paul Elder
2026-09-17 21:07 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox