summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTal Cohen <talcohen@habana.ai>2022-10-03 13:55:50 +0300
committerOded Gabbay <ogabbay@kernel.org>2022-11-23 16:13:42 +0200
commit27cd39afde454ca8f9a438cfc84d676e96b36bd7 (patch)
tree760cd61208141baa153aee234387461b75686a93
parent4f11694f27582fa0875c4be7d133e0ae88ad36f8 (diff)
downloadlinux-stable-27cd39afde454ca8f9a438cfc84d676e96b36bd7.tar.gz
linux-stable-27cd39afde454ca8f9a438cfc84d676e96b36bd7.tar.bz2
linux-stable-27cd39afde454ca8f9a438cfc84d676e96b36bd7.zip
habanalabs: verify no zero event is sent
The event notifier mechanism should not raise an empty event (event equals zero). Signed-off-by: Tal Cohen <talcohen@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
-rw-r--r--drivers/misc/habanalabs/common/device.c5
-rw-r--r--drivers/misc/habanalabs/gaudi/gaudi.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index b8b32285720d..9b54d1df5302 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -1746,6 +1746,11 @@ void hl_notifier_event_send_all(struct hl_device *hdev, u64 event_mask)
{
struct hl_fpriv *hpriv;
+ if (!event_mask) {
+ dev_warn(hdev->dev, "Skip sending zero event");
+ return;
+ }
+
mutex_lock(&hdev->fpriv_list_lock);
list_for_each_entry(hpriv, &hdev->fpriv_list, dev_node)
diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 1a99f7be8b60..337123f73501 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -7945,7 +7945,9 @@ reset_device:
/* despite reset doesn't execute. a notification on
* occurred event needs to be sent here
*/
- hl_notifier_event_send_all(hdev, event_mask);
+ if (event_mask)
+ hl_notifier_event_send_all(hdev, event_mask);
+
if (reset_required)
hl_device_reset(hdev, flags);
else