# git rev-parse -q --verify d652d5f1eeeb06046009f4fcb9b4542249526916^{commit} d652d5f1eeeb06046009f4fcb9b4542249526916 already have revision, skipping fetch # git checkout -q -f -B kisskb d652d5f1eeeb06046009f4fcb9b4542249526916 # git clean -qxdf # < git log -1 # commit d652d5f1eeeb06046009f4fcb9b4542249526916 # Author: Linus Torvalds # Date: Thu Dec 17 09:27:57 2020 -0800 # # drm/edid: fix objtool warning in drm_cvt_modes() # # Commit 991fcb77f490 ("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 # Cc: Ilia Mirkin # Cc: Josh Poimboeuf # Cc: Peter Zijlstra # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux-ld --version # < git log --format=%s --max-count=1 d652d5f1eeeb06046009f4fcb9b4542249526916 # < make -s -j 120 ARCH=m68k O=/kisskb/build/linus_m68k-defconfig_m68k-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux- defconfig # make -s -j 120 ARCH=m68k O=/kisskb/build/linus_m68k-defconfig_m68k-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux- /kisskb/src/arch/m68k/mvme16x/config.c: In function 'mvme16x_hwclk': /kisskb/src/arch/m68k/mvme16x/config.c:437:2: warning: #warning check me! [-Wcpp] #warning check me! ^~~~~~~ /kisskb/src/arch/m68k/mvme147/config.c: In function 'mvme147_hwclk': /kisskb/src/arch/m68k/mvme147/config.c:172:2: warning: #warning check me! [-Wcpp] #warning check me! ^~~~~~~ In file included from /kisskb/src/drivers/net/ethernet/8390/xsurf100.c:48: /kisskb/src/drivers/net/ethernet/8390/lib8390.c:995:27: warning: '____alloc_ei_netdev' defined but not used [-Wunused-function] static struct net_device *____alloc_ei_netdev(int size) ^~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:957:13: warning: '__ei_set_multicast_list' defined but not used [-Wunused-function] static void __ei_set_multicast_list(struct net_device *dev) ^~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:857:33: warning: '__ei_get_stats' defined but not used [-Wunused-function] static struct net_device_stats *__ei_get_stats(struct net_device *dev) ^~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:512:13: warning: '__ei_poll' defined but not used [-Wunused-function] static void __ei_poll(struct net_device *dev) ^~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:303:20: warning: '__ei_start_xmit' defined but not used [-Wunused-function] static netdev_tx_t __ei_start_xmit(struct sk_buff *skb, ^~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:257:13: warning: '__ei_tx_timeout' defined but not used [-Wunused-function] static void __ei_tx_timeout(struct net_device *dev, unsigned int txqueue) ^~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:233:12: warning: '__ei_close' defined but not used [-Wunused-function] static int __ei_close(struct net_device *dev) ^~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:204:12: warning: '__ei_open' defined but not used [-Wunused-function] static int __ei_open(struct net_device *dev) ^~~~~~~~~ Completed OK # rm -rf /kisskb/build/linus_m68k-defconfig_m68k-gcc8 # Build took: 0:01:08.252139