Re: [PATCH V4 4/5] misc: mlx5ctl: Add command rpc ioctl

From: Saeed Mahameed
Date: Sat Mar 02 2024 - 02:49:02 EST


On 29 Feb 12:49, Vegard Nossum wrote:

On 07/02/2024 08:24, Saeed Mahameed wrote:
@@ -328,6 +420,11 @@ static int mlx5ctl_probe(struct auxiliary_device *adev,
goto abort;
}
+ err = sysfs_create_link_nowarn(&mcdev->miscdev.this_device->kobj,
+ &mdev->device->kobj, "mdev");
+ if (err)
+ mlx5ctl_dbg(mcdev, "mlx5ctl: failed to create sysfs link err %d\n", err);
+

Should this propagate the error to the caller?


this link is informational only and not necessary for the driver function,
it meant to help user-space apps to associate mlx5ctl driver with it parent mlx5_core device.

What happens if/when mlx5ctl_remove()/sysfs_remove_link() gets called
later for this kobj?


sysfs_remove_link() will eventually call kernfs_remove_by_name_ns()
and it will return -ENOENT; if not found, and it will be silently dropped.