• Jon Hunter's avatar
    regulator: Fix deadlock during regulator registration · 18055cbc
    Jon Hunter authored
    commit a2151374 upstream.
    
    Commit 5e3ca2b3 ("regulator: Try to resolve regulators supplies on
    registration") added a call to regulator_resolve_supply() within
    regulator_register() where the regulator_list_mutex is held. This causes
    a deadlock to occur on the Tegra114 Dalmore board when the palmas PMIC
    is registered because regulator_register_resolve_supply() calls
    regulator_dev_lookup() which may try to acquire the regulator_list_mutex
    again.
    
    Fix this by releasing the mutex before calling
    regulator_register_resolve_supply() and update the error exit path to
    ensure the mutex is released on an error.
    
    [Made commit message more legible -- broonie]
    Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    18055cbc
core.c 115 KB