Skip to content
  • Phillip Potter's avatar
    c446f0d4
    isdn: mISDNinfineon: check/cleanup ioremap failure correctly in setup_io · c446f0d4
    Phillip Potter authored
    
    
    Move hw->cfg.mode and hw->addr.mode assignments from hw->ci->cfg_mode
    and hw->ci->addr_mode respectively, to be before the subsequent checks
    for memory IO mode (and possible ioremap calls in this case).
    
    Also introduce ioremap error checks at both locations. This allows
    resources to be properly freed on ioremap failure, as when the caller
    of setup_io then subsequently calls release_io via its error path,
    release_io can now correctly determine the mode as it has been set
    before the ioremap call.
    
    Finally, refactor release_io function so that it will call
    release_mem_region in the memory IO case, regardless of whether or not
    hw->cfg.p/hw->addr.p are NULL. This means resources are then properly
    released on failure.
    
    This properly implements the original reverted commit (d721fe99)
    from the University of Minnesota, whilst also implementing the ioremap
    check for the hw->ci->cfg_mode if block as well.
    
    Cc: David S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarPhillip Potter <phil@philpotter.co.uk>
    Link: https://lore.kernel.org/r/20210503115736.2104747-42-gregkh@linuxfoundation.org
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c446f0d4
    isdn: mISDNinfineon: check/cleanup ioremap failure correctly in setup_io
    Phillip Potter authored
    
    
    Move hw->cfg.mode and hw->addr.mode assignments from hw->ci->cfg_mode
    and hw->ci->addr_mode respectively, to be before the subsequent checks
    for memory IO mode (and possible ioremap calls in this case).
    
    Also introduce ioremap error checks at both locations. This allows
    resources to be properly freed on ioremap failure, as when the caller
    of setup_io then subsequently calls release_io via its error path,
    release_io can now correctly determine the mode as it has been set
    before the ioremap call.
    
    Finally, refactor release_io function so that it will call
    release_mem_region in the memory IO case, regardless of whether or not
    hw->cfg.p/hw->addr.p are NULL. This means resources are then properly
    released on failure.
    
    This properly implements the original reverted commit (d721fe99)
    from the University of Minnesota, whilst also implementing the ioremap
    check for the hw->ci->cfg_mode if block as well.
    
    Cc: David S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarPhillip Potter <phil@philpotter.co.uk>
    Link: https://lore.kernel.org/r/20210503115736.2104747-42-gregkh@linuxfoundation.org
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading