[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ytf0vDVH7+05f0IS@nanopsycho>
Date: Wed, 20 Jul 2022 14:27:40 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Ido Schimmel <idosch@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
petrm@...dia.com, pabeni@...hat.com, edumazet@...gle.com,
mlxsw@...dia.com, saeedm@...dia.com, snelson@...sando.io
Subject: Re: [patch net-next v2 05/12] mlxsw: core_linecards: Expose HW
revision and INI version
Wed, Jul 20, 2022 at 10:56:35AM CEST, idosch@...dia.com wrote:
>On Tue, Jul 19, 2022 at 08:48:40AM +0200, Jiri Pirko wrote:
>> +int mlxsw_linecard_devlink_info_get(struct mlxsw_linecard *linecard,
>> + struct devlink_info_req *req,
>> + struct netlink_ext_ack *extack)
>> +{
>> + char buf[32];
>> + int err;
>> +
>> + mutex_lock(&linecard->lock);
>> + if (WARN_ON(!linecard->provisioned)) {
>> + err = 0;
>
>Why not:
>
>err = -EINVAL;
>
>?
Well, a) this should not happen. No need to push error to the user for
this as the rest of the info message is still fine.
>
>> + goto unlock;
>> + }
>> +
>> + sprintf(buf, "%d", linecard->hw_revision);
>> + err = devlink_info_version_fixed_put(req, "hw.revision", buf);
>> + if (err)
>> + goto unlock;
>> +
>> + sprintf(buf, "%d", linecard->ini_version);
>> + err = devlink_info_version_running_put(req, "ini.version", buf);
>> + if (err)
>> + goto unlock;
>> +
>> +unlock:
>> + mutex_unlock(&linecard->lock);
>> + return err;
>> +}
>> +
>> static int
>> mlxsw_linecard_provision_set(struct mlxsw_linecard *linecard, u8 card_type,
>> u16 hw_revision, u16 ini_version)
>> --
>> 2.35.3
>>
Powered by blists - more mailing lists