[ndctl PATCH] util/sysfs: do not fail on missing bind attributes
Alison Schofield <[email protected]>
| Newsgroups | dev.linux.lists.nvdimm,org.kernel.vger.linux-cxl |
|---|---|
| Message-ID | <[email protected]> |
From: Tao Xu <[email protected]> Kernel commit cb9cfff82f6a ("cxl/acpi: Simplify cxl_nvdimm_bridge probing") removed bind attrributes for cxl_pmem_region and cxl_nvdimm* objects. __util_bind() currently attempts to write to the bind attribute of every entry under /sys/bus/cxl/drivers/. On kernels where some driver directories no longer provide that attribute, these attempts fail with ENOENT and produce misleading bind errors. Check that the bind attribute exists before attempting the write. [ as: commit log edited ] Reported-by: Tao Xu <[email protected]> Closes: https://github.com/pmem/ndctl/issues/298 Signed-off-by: Tao Xu <[email protected]> Reviewed-by: Alison Schofield <[email protected]> Signed-off-by: Alison Schofield <[email protected]> --- util/sysfs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/sysfs.c b/util/sysfs.c index eaf4b60aacee..2dd4b48b4459 100644 --- a/util/sysfs.c +++ b/util/sysfs.c @@ -258,6 +258,11 @@ int __util_bind(const char *devname, struct kmod_module *module, continue; } + if (access(drv_path, F_OK) != 0) { + free(drv_path); + continue; + } + rc = __sysfs_write_attr_quiet(ctx, drv_path, devname); free(drv_path); if (rc == 0) -- 2.37.3