• Viresh Kumar's avatar
    PM / OPP: Fix memory leak while adding duplicate OPPs · 7f8538eb
    Viresh Kumar authored
    There are two types of duplicate OPPs that get different behavior from
    the core:
    A) An earlier OPP is marked 'available' and has same freq/voltages as
       the new one.
    B) An earlier OPP with same frequency, but is marked 'unavailable' OR
       doesn't have same voltages as the new one.
    
    The OPP core returns 0 for the first one, but -EEXIST for the second.
    
    While the OPP core returns 0 for the first case, its callers don't free
    the newly allocated OPP structure which isn't used anymore. Fix that by
    returning -EBUSY instead of 0, but make the callers return 0 eventually.
    
    As this isn't a critical fix, its not getting marked for stable kernel.
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    7f8538eb
core.c 54 KB