diff mbox

[RFC,5/6] libnvdimm: fail call_dsm on unsupported devices

Message ID 20160113053946.6293.52129.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State RFC
Headers show

Commit Message

Dan Williams Jan. 13, 2016, 5:39 a.m. UTC
Now that buses and nvdimms are advertising their support for the
call_dsm command, fail the command early if the bus has not opted-in for
support.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/bus.c |    2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index b86d5eda78ed..0dc6210d568c 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -532,6 +532,8 @@  static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 	}
 
 	if (cmd == ND_CMD_CALL_DSM) {
+		if (!nd_desc->call_dsm)
+			return -ENOTTY;
 		if (copy_from_user(&call_dsm, p, sizeof(cmd)))
 			return -EFAULT;
 		func = call_dsm.dsm_fun_idx;