public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dax: Add direct_access() callback check for dax_direct_access()
@ 2026-03-06 23:05 Dave Jiang
  2026-03-09 16:58 ` Ira Weiny
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2026-03-06 23:05 UTC (permalink / raw)
  To: nvdimm, linux-cxl; +Cc: dan.j.williams, vishal.l.verma, ira.weiny

__devm_create_dev_dax() calls alloc_dax() with the ops parameter passed
in as NULL. Therefore the ops pointer in dev_dax can be NULL. Add a
check in dax_direct_access() for ops and ops->direct_access() before
calling ops->direct_access().

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dax/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index c00b9dff4a06..5cebaf11a58e 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -160,6 +160,9 @@ long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
 	if (nr_pages < 0)
 		return -EINVAL;
 
+	if (!dax_dev->ops || !dax_dev->ops->direct_access)
+		return -EOPNOTSUPP;
+
 	avail = dax_dev->ops->direct_access(dax_dev, pgoff, nr_pages,
 			mode, kaddr, pfn);
 	if (!avail)

base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-09 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 23:05 [PATCH] dax: Add direct_access() callback check for dax_direct_access() Dave Jiang
2026-03-09 16:58 ` Ira Weiny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox