drm/radeon/r100: Handle unknown family in r100_cp_init_microcode()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 30 Jul 2024 15:58:12 +0000 (17:58 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Aug 2024 14:27:15 +0000 (10:27 -0400)
commitc6dbab46324b1742b50dc2fb5c1fee2c28129439
tree829fbc176b1777b1fc196f7fbf7056abaa05d8f2
parent020620424b27bababf7f53d00692ab919c357a3f
drm/radeon/r100: Handle unknown family in r100_cp_init_microcode()

With -Werror:

    In function ‘r100_cp_init_microcode’,
inlined from ‘r100_cp_init’ at drivers/gpu/drm/radeon/r100.c:1136:7:
    include/linux/printk.h:465:44: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
      465 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
  |                                            ^
    include/linux/printk.h:437:17: note: in definition of macro ‘printk_index_wrap’
      437 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
  |                 ^~~~~~~
    include/linux/printk.h:508:9: note: in expansion of macro ‘printk’
      508 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
  |         ^~~~~~
    drivers/gpu/drm/radeon/r100.c:1062:17: note: in expansion of macro ‘pr_err’
     1062 |                 pr_err("radeon_cp: Failed to load firmware \"%s\"\n", fw_name);
  |                 ^~~~~~

Fix this by converting the if/else if/... construct into a proper
switch() statement with a default to handle the error case.

As a bonus, the generated code is ca. 100 bytes smaller (with gcc 11.4.0
targeting arm32).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/r100.c