diff mbox series

[1/3] video: sunxi: Change sunxi_get_mon_desc() to not return NULL for the default case

Message ID 1586176565-29951-2-git-send-email-bmeng.cn@gmail.com
State New
Headers show
Series azure/gitlab/travis: Switch to gcc 9.2.0 | expand

Commit Message

Bin Meng April 6, 2020, 12:36 p.m. UTC
When building with gcc 9.2.0, the following build warning was seen:

  drivers/video/sunxi/sunxi_display.c: In function 'video_hw_init':
  drivers/video/sunxi/sunxi_display.c:1217:2:
    error: '%s' directive argument is null [-Werror=format-overflow=]

Change sunxi_get_mon_desc() to not return NULL for the default case,
to fix the compiler warning.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 drivers/video/sunxi/sunxi_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini April 6, 2020, 12:41 p.m. UTC | #1
On Mon, Apr 06, 2020 at 05:36:03AM -0700, Bin Meng wrote:

> When building with gcc 9.2.0, the following build warning was seen:
> 
>   drivers/video/sunxi/sunxi_display.c: In function 'video_hw_init':
>   drivers/video/sunxi/sunxi_display.c:1217:2:
>     error: '%s' directive argument is null [-Werror=format-overflow=]
> 
> Change sunxi_get_mon_desc() to not return NULL for the default case,
> to fix the compiler warning.
> 
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
> 
>  drivers/video/sunxi/sunxi_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
> index 31f0aa7..5679d83 100644
> --- a/drivers/video/sunxi/sunxi_display.c
> +++ b/drivers/video/sunxi/sunxi_display.c
> @@ -1024,7 +1024,7 @@ static const char *sunxi_get_mon_desc(enum sunxi_monitor monitor)
>  	case sunxi_monitor_composite_pal_m:	return "composite-pal-m";
>  	case sunxi_monitor_composite_pal_nc:	return "composite-pal-nc";
>  	}
> -	return NULL; /* never reached */
> +	return "none"; /* never reached */
>  }
>  
>  ulong board_get_usable_ram_top(ulong total_size)

That's fine.  But do we want to re-work the function to catch
sunxi_monitor_none in the default case and use "none" there as well
(like it does today) to silence the warning?  Thanks!
diff mbox series

Patch

diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index 31f0aa7..5679d83 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -1024,7 +1024,7 @@  static const char *sunxi_get_mon_desc(enum sunxi_monitor monitor)
 	case sunxi_monitor_composite_pal_m:	return "composite-pal-m";
 	case sunxi_monitor_composite_pal_nc:	return "composite-pal-nc";
 	}
-	return NULL; /* never reached */
+	return "none"; /* never reached */
 }
 
 ulong board_get_usable_ram_top(ulong total_size)