diff mbox series

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

Message ID 1586178420-31046-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit a0c91fe241d6dd10ac0fd2a9f2e4e40f4851c9bd
Delegated to: Tom Rini
Headers show
Series azure/gitlab/travis: Switch to gcc 9.2.0 | expand

Commit Message

Bin Meng April 6, 2020, 1:06 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@gmail.com>

---

Changes in v2:
- catch sunxi_monitor_none in the default case and use "none" there

 drivers/video/sunxi/sunxi_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini April 6, 2020, 1:07 p.m. UTC | #1
On Mon, Apr 06, 2020 at 06:06:58AM -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@gmail.com>
> 

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini April 11, 2020, 1:17 a.m. UTC | #2
On Mon, Apr 06, 2020 at 06:06:58AM -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@gmail.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index 31f0aa7..4e1720e 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -1014,7 +1014,6 @@  static void sunxi_mode_set(const struct ctfb_res_modes *mode,
 static const char *sunxi_get_mon_desc(enum sunxi_monitor monitor)
 {
 	switch (monitor) {
-	case sunxi_monitor_none:		return "none";
 	case sunxi_monitor_dvi:			return "dvi";
 	case sunxi_monitor_hdmi:		return "hdmi";
 	case sunxi_monitor_lcd:			return "lcd";
@@ -1023,8 +1022,9 @@  static const char *sunxi_get_mon_desc(enum sunxi_monitor monitor)
 	case sunxi_monitor_composite_ntsc:	return "composite-ntsc";
 	case sunxi_monitor_composite_pal_m:	return "composite-pal-m";
 	case sunxi_monitor_composite_pal_nc:	return "composite-pal-nc";
+	case sunxi_monitor_none:		/* fall through */
+	default:				return "none";
 	}
-	return NULL; /* never reached */
 }
 
 ulong board_get_usable_ram_top(ulong total_size)