Skip to content
  • Arnd Bergmann's avatar
    drivers/memstick/host/r592.c: avoid gcc-6 warning · f419a08f
    Arnd Bergmann authored
    
    
    The r592 driver relies on behavior of the DMA mapping API that is
    normally observed but not guaranteed by the API.  Instead it uses a
    runtime check to fail transfers if the API ever behaves
    
    When CONFIG_NEED_SG_DMA_LENGTH is not set, one of the checks turns into a
    comparison of a variable with itself, which gcc-6.0 now warns about:
    
    drivers/memstick/host/r592.c: In function 'r592_transfer_fifo_dma':
    drivers/memstick/host/r592.c:302:31: error: self-comparison always evaluates to false [-Werror=tautological-compare]
        (sg_dma_len(&dev->req->sg) < dev->req->sg.length)) {
                                   ^
    
    The check itself is not a problem, so this patch just rephrases the
    condition in a way that gcc does not consider an indication of a mistake.
    We already know that dev->req->sg.length was initially R592_LFIFO_SIZE, so
    we can compare it to that constant again.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Cc: Maxim Levitsky <maximlevitsky@gmail.com>
    Cc: Quentin Lambert <lambert.quentin@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    f419a08f