lkml.org 
[lkml]   [2020]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 3/4] powercap/drivers/dtpm: Add API for dynamic thermal power management
From
Date


On 12/2/20 12:37 PM, Lukasz Luba wrote:
> Hi Daniel,
>
> I realized small issue when I went through this new mutex code
> (which is safer IMHO).
>
> On 12/1/20 7:28 PM, Daniel Lezcano wrote:
>
> [snip]
>
>> +int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm
>> *parent)
>> +{
>> +    struct powercap_zone *pcz;
>> +
>> +    if (!pct)
>> +        return -EAGAIN;
>> +
>> +    if (root && !parent)
>> +        return -EBUSY;
>> +
>> +    if (!root && parent)
>> +        return -EINVAL;
>> +
>> +    if (parent && parent->ops)
>> +        return -EINVAL;
>> +
>
> Maybe it worth to add a check of dtpm pointer here, just to play safe?
>
>     if (!dtpm)
>         return -EINVAL;
>
> The dtpm->ops might explode when we don't capture this miss-usage during
> reviews of future drivers/shim layers. What do you think?
>
>
>> +    if (dtpm->ops && !(dtpm->ops->set_power_uw &&
>> +               dtpm->ops->get_power_uw &&
>> +               dtpm->ops->release))
>> +        return -EINVAL;
>> +
>
> I am going to stress test the whole series with hotplug today
> and add review for patch 4/4.
>

I have tested with a hotplug stress and looks OK with the mutex.
You can add again the tag:

Tested-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz

\
 
 \ /
  Last update: 2020-12-02 18:22    [W:0.371 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site