[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b457bd8b-cf60-95a6-60eb-33b7a5ec06a4@nvidia.com>
Date: Tue, 15 Sep 2020 23:06:16 +0300
From: Moshe Shemesh <moshe@...dia.com>
To: Jiri Pirko <jiri@...nulli.us>
CC: Moshe Shemesh <moshe@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jiri Pirko <jiri@...lanox.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next RFC v4 01/15] devlink: Add reload action option
to devlink reload command
On 9/15/2020 4:26 PM, Jiri Pirko wrote:
> Tue, Sep 15, 2020 at 02:12:25PM CEST, moshe@...dia.com wrote:
>> On 9/14/2020 3:27 PM, Jiri Pirko wrote:
>>> Mon, Sep 14, 2020 at 08:07:48AM CEST, moshe@...lanox.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;
>>>> + }
> [...]
Powered by blists - more mailing lists