Skip to content
  • Axel Lin's avatar
    regulator: ab3100: Fix regulator register error handling · 018fd856
    Axel Lin authored
    
    
    Ensure to unregister all regulators before return error in probe().
    
    The regulator register order depends on the regulator ID pass to
    ab3100_regulator_register() function. Thus we need to scan ab3100_regulator_desc
    and find the index of successfully registered regulators, or alternatively just
    call ab3100_regulators_remove() to unregister all registered regulators.
    
    Since current code uses a static ab3100_regulators table, explicitly set
    reg->rdev = NULL after regulator_unregister() call to ensure calling
    ab3100_regulators_remove() in the unwind path always work.
    
    Also move ab3100_regulators_remove() to avoid forward declaration.
    
    Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
    Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
    018fd856