Re: [PATCH net 1/3] net/mlx5e: Harden uplink netdev access against device unbind

From: Jianbo Liu

Date: Tue Sep 09 2025 - 23:25:42 EST




On 9/10/2025 9:23 AM, Jakub Kicinski wrote:
On Mon, 8 Sep 2025 13:07:04 +0300 Tariq Toukan wrote:
+ struct net_device *netdev = mlx5_uplink_netdev_get(dev);
+ struct mlx5e_priv *priv;
+ int err;
+
+ if (!netdev)
+ return 0;

Please don't call in variable init functions which require cleanup
or error checking.

But in this function, a NULL return from mlx5_uplink_netdev_get is a valid condition where it should simply return 0. No cleanup or error check is needed.

Thanks!
Jianbo