Messages in this thread | | | Date | Thu, 15 May 2014 13:55:39 +0530 | Subject | Re: [PATCH] PM / OPP: discard duplicate OPP additions | From | Chander Kashyap <> |
| |
On 14 May 2014 19:57, Nishanth Menon <nm@ti.com> wrote: > On 05/14/2014 06:08 AM, Viresh Kumar wrote: >> On 14 May 2014 15:01, Chander Kashyap <chander.kashyap@linaro.org> wrote: >>>> say we do at this point: >>>> if (new_opp->rate == opp->rate) { >>>> dev_err(dev, "%s: attempt to add duplicate OPP entry (rate=%ld)\n", >>>> __func__, new_opp->rate) >>>> kfree(new_opp); >>>> return -EINVAL; >>>> } >>> >>> Yes this is more cleaner. >>> But instead of dev_err, we should use dev_warn and secondly >> >> Correct >> >>> return 0 rather than EINVAL, as there are independent users for this function >> >> Why? We should actually use EEXIST here instead of EINVAL though.. >> > Yep -EEXIST is the right return value here. As Viresh indicated, > reporting back 0 when the requested operation actually was not > performed is wrong. Caller is supposed to know when it makes an error > - hiding it is not correct. >
Then in that case the caller must take care for two type of errors: -EEXIST and -ENOMEM
> -- > Regards, > Nishanth Menon
-- with warm regards, Chander Kashyap
| |