Subject: Re: [patch net-next v2 05/12] mlxsw: core_linecards: Expose HW revision and INI version

From: Ido Schimmel <[email-masked]>
Date: Wed, 20 Jul 2022 15:50:09 +0300

On Wed, Jul 20, 2022 at 03:43:17PM +0300, Ido Schimmel wrote:
> On Wed, Jul 20, 2022 at 02:27:40PM +0200, Jiri Pirko wrote:
> > Wed, Jul 20, 2022 at 10:56:35AM CEST, [email-masked] 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.
> 
> Not sure what you mean by "the rest of the info message is still fine".
> Which info message? If the line card is not provisioned, then it
> shouldn't even have a devlink instance and it will not appear in
> "devlink dev info" dump.

How about returning '-EOPNOTSUPP'? Looks like devlink will skip it in a
dump