Re: [PATCH net-next v3 1/5] devlink: Reduce struct devlink exposure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu,  7 Oct 2021 09:55:15 +0300
Leon Romanovsky <leon@xxxxxxxxxx> wrote:

> +void *devlink_priv(struct devlink *devlink)
> +{
> +	BUG_ON(!devlink);

Do we really want to bring down the kernel in this case?

Can't we just have:

	if (WARN_ON(!devlink))
		return NULL;
?

Same for the below as well.

-- 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);
> +



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux