lkml.org 
[lkml]   [2020]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next RFC v4 01/15] devlink: Add reload action option to devlink reload command
From
Date

On 9/15/2020 4:26 PM, Jiri Pirko wrote:
> Tue, Sep 15, 2020 at 02:12:25PM CEST, moshe@nvidia.com wrote:
>> On 9/14/2020 3:27 PM, Jiri Pirko wrote:
>>> Mon, Sep 14, 2020 at 08:07:48AM CEST, moshe@mellanox.com wrote:
> [..]
>
>>>> @@ -7392,6 +7485,11 @@ struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size)
>>>> if (!devlink)
>>>> return NULL;
>>>> devlink->ops = ops;
>>>> + if (devlink_reload_actions_verify(devlink)) {
>>> Move this check to the beginning. You don't need devlink instance for
>>> the check, just ops.
>>
>> Right, will fix.
>>
>>> also, your devlink_reload_actions_verify() function returns
>>> 0/-ESOMETHING. Treat it accordingly here.
>>
>> Well, yes, but I rather return NULL here since devlink_alloc() failed. If
>> devlink_reload_actions_verify() fails it has WARN_ON which will lead the
>> driver developer to his bug.
> So let the verify() return bool.
> My point is, if a function return 0/-ESOMETHING, you should not check
> the return value directly but you should use int err/ret.


OK, will fix.

>>>> + kfree(devlink);
>>>> + return NULL;
>>>> + }
> [...]

\
 
 \ /
  Last update: 2020-09-15 22:08    [W:0.100 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site