summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorOhad Sharabi <osharabi@habana.ai>2022-11-06 09:26:01 +0200
committerOded Gabbay <ogabbay@kernel.org>2022-11-23 16:13:46 +0200
commitb829e01025f8936bb85bdc39cbd1faddcca290d0 (patch)
tree6059158ea5ad0ca0ce1077cde594e94050d4a12a /drivers/misc
parent3daa64eea1fb219c8cfb3bb6948dc2993652e201 (diff)
downloadlinux-stable-b829e01025f8936bb85bdc39cbd1faddcca290d0.tar.gz
linux-stable-b829e01025f8936bb85bdc39cbd1faddcca290d0.tar.bz2
linux-stable-b829e01025f8936bb85bdc39cbd1faddcca290d0.zip
habanalabs: skip events info ioctl if not supported
Some ASICs haven't yet implemented this functionality and so the ioctl call should fail and the user should be notified of the reason. Signed-off-by: Ohad Sharabi <osharabi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/habanalabs_ioctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
index ee43017eb563..b6abfa7761a7 100644
--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
@@ -123,6 +123,10 @@ static int hw_events_info(struct hl_device *hdev, bool aggregate,
return -EINVAL;
arr = hdev->asic_funcs->get_events_stat(hdev, aggregate, &size);
+ if (!arr) {
+ dev_err(hdev->dev, "Events info not supported\n");
+ return -EOPNOTSUPP;
+ }
return copy_to_user(out, arr, min(max_size, size)) ? -EFAULT : 0;
}