linux/drivers/gpu/drm
Linus Torvalds d652d5f1ee drm/edid: fix objtool warning in drm_cvt_modes()
Commit 991fcb77f4 ("drm/edid: Fix uninitialized variable in
drm_cvt_modes()") just replaced one warning with another.

The original warning about a possibly uninitialized variable was due to
the compiler not being smart enough to see that the case statement
actually enumerated all possible cases.  And the initial fix was just to
add a "default" case that had a single "unreachable()", just to tell the
compiler that that situation cannot happen.

However, that doesn't actually fix the fundamental reason for the
problem: the compiler still doesn't see that the existing case
statements enumerate all possibilities, so the compiler will still
generate code to jump to that unreachable case statement.  It just won't
complain about an uninitialized variable any more.

So now the compiler generates code to our inline asm marker that we told
it would not fall through, and end end result is basically random.  We
have created a bridge to nowhere.

And then, depending on the random details of just exactly what the
compiler ends up doing, 'objtool' might end up complaining about the
conditional branches (for conditions that cannot happen, and that thus
will never be taken - but if the compiler was not smart enough to figure
that out, we can't expect objtool to do so) going off in the weeds.

So depending on how the compiler has laid out the result, you might see
something like this:

    drivers/gpu/drm/drm_edid.o: warning: objtool: do_cvt_mode() falls through to next function drm_mode_detailed.isra.0()

and now you have a truly inscrutable warning that makes no sense at all
unless you start looking at whatever random code the compiler happened
to generate for our bare "unreachable()" statement.

IOW, don't use "unreachable()" unless you have an _active_ operation
that generates code that actually makes it obvious that something is not
reachable (ie an UD instruction or similar).

Solve the "compiler isn't smart enough" problem by just marking one of
the cases as "default", so that even when the compiler doesn't otherwise
see that we've enumerated all cases, the compiler will feel happy and
safe about there always being a valid case that initializes the 'width'
variable.

This also generates better code, since now the compiler doesn't generate
comparisons for five different possibilities (the four real ones and the
one that can't happen), but just for the three real ones and "the rest"
(which is that last one).

A smart enough compiler that sees that we cover all the cases won't care.

Cc: Lyude Paul <lyude@redhat.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-12-17 09:27:57 -08:00
..
amd drm/amdgpu: fix check order in amdgpu_bo_move 2020-12-14 16:00:46 -08:00
arc drm/atomic: Pass the full state to CRTC atomic enable/disable 2020-10-09 09:55:59 +02:00
arm drm: Use state helper instead of CRTC state pointer 2020-11-10 12:41:06 +01:00
armada drm/armada/armada_overlay: Staticify local function 'armada_overlay_duplicate_state' 2020-11-17 18:34:13 +01:00
aspeed drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
ast drm/ast: Reload gamma LUT after changing primary plane's color format 2020-11-25 09:13:20 +01:00
atmel-hlcdc drm/atmel-hlcdc/atmel_hlcdc_plane: Fix documentation formatting and add missing description 2020-11-12 20:26:47 +01:00
bochs drm/fb_helper: Support framebuffers in I/O memory 2020-11-09 09:20:00 +01:00
bridge drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
etnaviv Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next 2020-12-03 13:25:23 +10:00
exynos drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
fsl-dcu drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
gma500 drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
hisilicon drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
i2c sound updates for 5.9 2020-08-06 14:27:31 -07:00
i810 drm/i810: make i810_flush_queue() return void 2020-09-11 10:54:17 +02:00
i915 drm/i915: make relay callbacks const 2020-12-15 22:46:18 -08:00
imx Merge drm/drm-next into drm-misc-next 2020-11-10 17:11:37 +01:00
ingenic drm/ingenic: ipu: Search for scaling coefs up to 102% of the screen 2020-11-11 11:47:11 +00:00
kmb drm/Kconfig: rename keembay config 2020-11-13 14:53:34 +10:00
lib
lima Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
mcde drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
mediatek ARM: SoC drivers for v5.11 2020-12-16 16:38:41 -08:00
meson drm/meson/meson_vclk: Make two local functions static 2020-11-17 18:34:14 +01:00
mga drm/mga/mga_state: Remove unused variable 'buf_priv' 2020-11-06 23:19:07 +01:00
mgag200 drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
msm IOMMU updates for 5.11 2020-12-16 13:58:47 -08:00
mxsfb drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
nouveau drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
omapdrm drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
panel drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
panfrost IOMMU updates for 5.11 2020-12-16 13:58:47 -08:00
pl111 drm/pl111/pl111_debugfs: Make local function 'pl111_debugfs_regs()' static 2020-11-17 20:02:49 +01:00
qxl drm/qxl: Remove fbcon acceleration leftovers 2020-11-17 11:01:09 +01:00
r128 drm/r128/ati_pcigart: Source file headers are not good candidates for kernel-doc 2020-11-06 23:18:52 +01:00
radeon drm/radeon: fix check order in radeon_bo_move 2020-12-14 16:00:46 -08:00
rcar-du drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
rockchip drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
savage drm/savage/savage_bci: Remove set but never used 'aper_rsrc' and 'fb_rsrc' 2020-11-12 20:31:01 +01:00
scheduler Merge tag 'amd-drm-next-5.11-2020-12-09' of git://people.freedesktop.org/~agd5f/linux into drm-next 2020-12-10 16:55:53 +10:00
selftests drm/selftests/test-drm_dp_mst_helper: Move 'sideband_msg_req_encode_decode' onto the heap 2020-11-17 20:08:29 +01:00
shmobile drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
sis
sti drm/sti/sti_hdmi: Move 'colorspace_mode_names' array to where its used 2020-11-12 20:32:53 +01:00
stm drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
sun4i ARM: SoC drivers for v5.11 2020-12-16 16:38:41 -08:00
tdfx
tegra drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
tidss drm/tidss: use devm_platform_ioremap_resource_byname 2020-11-10 14:34:16 +02:00
tilcdc drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
tiny drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
ttm drm/ttm/ttm_tt: Demote kernel-doc header format abuses 2020-11-17 20:14:18 +01:00
tve200 drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
udl drm/udl: Fix missing error code in udl_handle_damage() 2020-11-13 15:03:48 +01:00
v3d drm/v3d/v3d_sched: Demote non-conformant kernel-doc header 2020-11-18 11:51:27 +01:00
vboxvideo drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
vc4 drm for 5.11-rc1 2020-12-14 11:07:56 -08:00
vgem drm/vgem: replace idr_init() by idr_init_base() 2020-11-10 15:22:28 +01:00
via drm/via/via_dma: Remove set but unused variable 'agp_base' 2020-11-12 21:25:33 +01:00
virtio drm/virtio: Make virtgpu_dmabuf_ops with static keyword 2020-11-16 08:53:23 +01:00
vkms drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
vmwgfx drm/ttm: add multihop infrastrucutre (v3) 2020-11-11 11:11:03 +10:00
xen drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
xlnx drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
zte drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
drm_agpsupport.c
drm_atomic_helper.c drm/atomic: Pass the full state to CRTC atomic begin and flush 2020-11-02 12:37:49 +01:00
drm_atomic_state_helper.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_atomic_uapi.c drm: fix oops in drm_atomic_set_crtc_for_connector 2020-11-16 09:56:55 +01:00
drm_atomic.c Merge branch 'akpm' (patches from Andrew) 2020-12-15 12:53:37 -08:00
drm_auth.c
drm_blend.c drm: Introduce plane and CRTC scaling filter properties 2020-10-21 12:19:54 +03:00
drm_bridge_connector.c gpu/drm: delete same check in if condition 2020-11-02 14:04:53 +01:00
drm_bridge.c
drm_bufs.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
drm_cache.c drm: core: fix common struct sg_table related issues 2020-09-10 08:17:48 +02:00
drm_client_modeset.c
drm_client.c drm/gem: Store client buffer mappings as struct dma_buf_map 2020-11-09 09:19:45 +01:00
drm_color_mgmt.c drm: unify formatting for color management documentation 2020-11-04 17:47:57 +01:00
drm_connector.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_context.c
drm_crtc_helper_internal.h drm/probe_helper: Add drm_connector_helper_funcs.mode_valid_ctx 2020-07-13 13:29:20 -04:00
drm_crtc_helper.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_crtc_internal.h drm: Introduce plane and CRTC scaling filter properties 2020-10-21 12:19:54 +03:00
drm_crtc.c drm: Introduce plane and CRTC scaling filter properties 2020-10-21 12:19:54 +03:00
drm_damage_helper.c
drm_debugfs_crc.c drm/crc-debugfs: Fix memleak in crc_control_write 2020-09-01 09:45:44 +02:00
drm_debugfs.c
drm_dma.c
drm_dp_aux_dev.c drm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor() 2020-10-15 13:58:54 -04:00
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_dp_mst_topology_internal.h
drm_dp_mst_topology.c drm/drm_dp_mst_topology: Remove set but never used variable 'len' 2020-11-17 18:34:13 +01:00
drm_drv.c drm: Allow const struct drm_driver 2020-11-06 10:31:26 +01:00
drm_dsc.c
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c drm/edid: fix objtool warning in drm_cvt_modes() 2020-12-17 09:27:57 -08:00
drm_encoder_slave.c
drm_encoder.c
drm_fb_cma_helper.c
drm_fb_helper.c drm/fb_helper: Use min_t() to handle size_t and unsigned long 2020-11-10 10:38:16 +01:00
drm_file.c drm: Compile out legacy chunks from struct drm_device 2020-11-06 10:31:26 +01:00
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c drm/fourcc: Add AXBXGXRX106106106106 format 2020-10-20 20:51:42 +01:00
drm_framebuffer.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_gem_cma_helper.c drm/cma-helper: Make default object functions the default 2020-11-09 09:23:03 +01:00
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
drm_gem_ttm_helper.c drm/ttm: Add vmap/vunmap to TTM and TTM GEM helpers 2020-11-09 09:17:36 +01:00
drm_gem_vram_helper.c drm/vram-helper: Fix use of top-down placement 2020-11-20 05:20:48 +10:00
drm_gem.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_hashtab.c
drm_hdcp.c
drm_internal.h drm/gem: Update internal GEM vmap/vunmap interfaces to use struct dma_buf_map 2020-11-09 09:19:36 +01:00
drm_ioc32.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_ioctl.c drm: Give irq_by_busid drm_legacy_ prefix 2020-10-21 18:05:11 +02:00
drm_irq.c
drm_kms_helper_common.c
drm_lease.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_legacy_misc.c
drm_legacy.h
drm_lock.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_managed.c drm/dev: Remove drm_dev_init 2020-09-21 10:45:08 +02:00
drm_memory.c
drm_mipi_dbi.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_mipi_dsi.c drm: mipi-dsi: Convert logging to drm_* functions. 2020-07-10 20:21:45 +02:00
drm_mm.c
drm_mode_config.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_mode_object.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_modes.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_panel_orientation_quirks.c drm: Added orientation quirk for ASUS tablet model T103HAF 2020-08-04 11:45:23 +02:00
drm_panel.c drm/panel: Add helper for reading DT rotation 2020-08-16 17:12:18 +02:00
drm_pci.c drm: Give irq_by_busid drm_legacy_ prefix 2020-10-21 18:05:11 +02:00
drm_plane_helper.c
drm_plane.c drm: Introduce plane and CRTC scaling filter properties 2020-10-21 12:19:54 +03:00
drm_prime.c drm/gem: Update internal GEM vmap/vunmap interfaces to use struct dma_buf_map 2020-11-09 09:19:36 +01:00
drm_print.c
drm_probe_helper.c Merge tag 'drm-intel-next-2020-07-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2020-07-31 14:42:37 +10:00
drm_property.c
drm_rect.c
drm_scatter.c
drm_scdc_helper.c drm: fix some kernel-doc markups 2020-11-16 20:48:20 +01:00
drm_self_refresh_helper.c
drm_simple_kms_helper.c drm: Use the state pointer directly in atomic_check 2020-11-03 12:20:09 +01:00
drm_syncobj.c drm/syncobj: Tune down unordered timeline DRM_ERROR 2020-08-02 15:22:31 +02:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank_work.c This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
drm_vblank.c drm: Compile out legacy chunks from struct drm_device 2020-11-06 10:31:26 +01:00
drm_vm.c drm: remove pgprot_decrypted() before calls to io_remap_pfn_range() 2020-11-10 17:19:14 +01:00
drm_vma_manager.c
drm_writeback.c
Kconfig drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
Makefile drm/kmb: Build files for KeemBay Display driver 2020-11-05 19:20:38 +01:00