From: Leon Romanovsky <leon@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Ido Schimmel <idosch@nvidia.com>, Ingo Molnar <mingo@redhat.com>,
Jiri Pirko <jiri@nvidia.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
mlxsw@nvidia.com, Moshe Shemesh <moshe@nvidia.com>,
netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
Salil Mehta <salil.mehta@huawei.com>,
Shay Drory <shayd@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>
Subject: Re: [PATCH net-next v3 1/5] devlink: Reduce struct devlink exposure
Date: Fri, 8 Oct 2021 03:44:48 +0300 [thread overview]
Message-ID: <YV+UgAEYz2GH8LIW@unreal> (raw)
In-Reply-To: <20211007155800.1ff26948@gandalf.local.home>
On Thu, Oct 07, 2021 at 03:58:00PM -0400, Steven Rostedt wrote:
> On Thu, 7 Oct 2021 09:55:15 +0300
> Leon Romanovsky <leon@kernel.org> wrote:
>
> > +void *devlink_priv(struct devlink *devlink)
> > +{
> > + BUG_ON(!devlink);
>
> Do we really want to bring down the kernel in this case?
It was before.
>
> Can't we just have:
>
> if (WARN_ON(!devlink))
> return NULL;
> ?
Callers of devlink_priv() are not prepared to have NULL here, they don't
check return value at all,and this BUG_ON() can't happen at all.
>
> Same for the below as well.
I can send followup patch.
Thanks
>
> -- Steve
>
> > + return &devlink->priv;
> > +}
> > +EXPORT_SYMBOL_GPL(devlink_priv);
> > +
> > +struct devlink *priv_to_devlink(void *priv)
> > +{
> > + BUG_ON(!priv);
> > + return container_of(priv, struct devlink, priv);
> > +}
> > +EXPORT_SYMBOL_GPL(priv_to_devlink);
> > +
> > +struct device *devlink_to_dev(const struct devlink *devlink)
> > +{
> > + return devlink->dev;
> > +}
> > +EXPORT_SYMBOL_GPL(devlink_to_dev);
> > +
next prev parent reply other threads:[~2021-10-08 0:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 6:55 [PATCH net-next v3 0/5] devlink reload simplification Leon Romanovsky
2021-10-07 6:55 ` [PATCH net-next v3 1/5] devlink: Reduce struct devlink exposure Leon Romanovsky
2021-10-07 19:58 ` Steven Rostedt
2021-10-08 0:44 ` Leon Romanovsky [this message]
2021-10-07 6:55 ` [PATCH net-next v3 2/5] devlink: Annotate devlink API calls Leon Romanovsky
2021-10-07 6:55 ` [PATCH net-next v3 3/5] devlink: Allow set reload ops callbacks separately Leon Romanovsky
2021-10-07 6:55 ` [PATCH net-next v3 4/5] net/mlx5: Separate reload devlink ops for multiport device Leon Romanovsky
2021-10-07 6:55 ` [PATCH net-next v3 5/5] devlink: Delete reload enable/disable interface Leon Romanovsky
2021-10-09 8:16 ` [PATCH net-next v3 0/5] devlink reload simplification Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YV+UgAEYz2GH8LIW@unreal \
--to=leon@kernel.org \
--cc=davem@davemloft.net \
--cc=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlxsw@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=saeedm@nvidia.com \
--cc=salil.mehta@huawei.com \
--cc=shayd@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).