Commit 49d2a8af authored by Oded Gabbay's avatar Oded Gabbay Committed by Greg Kroah-Hartman

habanalabs: use NULL for eventfd

eventfd is pointer. As such, it should be initialized to NULL, not to 0.

In addition, no need to initialize it after creation because the
entire structure is zeroed-out. Also, no need to initialize it before
release because the entire structure is freed.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 368b0b4f
...@@ -286,10 +286,8 @@ static void hpriv_release(struct kref *ref) ...@@ -286,10 +286,8 @@ static void hpriv_release(struct kref *ref)
hdev->compute_ctx_in_release = 0; hdev->compute_ctx_in_release = 0;
/* release the eventfd */ /* release the eventfd */
if (hpriv->notifier_event.eventfd) { if (hpriv->notifier_event.eventfd)
eventfd_ctx_put(hpriv->notifier_event.eventfd); eventfd_ctx_put(hpriv->notifier_event.eventfd);
hpriv->notifier_event.eventfd = 0;
}
mutex_destroy(&hpriv->notifier_event.lock); mutex_destroy(&hpriv->notifier_event.lock);
...@@ -364,10 +362,8 @@ static int hl_device_release_ctrl(struct inode *inode, struct file *filp) ...@@ -364,10 +362,8 @@ static int hl_device_release_ctrl(struct inode *inode, struct file *filp)
mutex_unlock(&hdev->fpriv_ctrl_list_lock); mutex_unlock(&hdev->fpriv_ctrl_list_lock);
out: out:
/* release the eventfd */ /* release the eventfd */
if (hpriv->notifier_event.eventfd) { if (hpriv->notifier_event.eventfd)
eventfd_ctx_put(hpriv->notifier_event.eventfd); eventfd_ctx_put(hpriv->notifier_event.eventfd);
hpriv->notifier_event.eventfd = 0;
}
mutex_destroy(&hpriv->notifier_event.lock); mutex_destroy(&hpriv->notifier_event.lock);
put_pid(hpriv->taskpid); put_pid(hpriv->taskpid);
......
...@@ -134,8 +134,6 @@ int hl_device_open(struct inode *inode, struct file *filp) ...@@ -134,8 +134,6 @@ int hl_device_open(struct inode *inode, struct file *filp)
hpriv->hdev = hdev; hpriv->hdev = hdev;
filp->private_data = hpriv; filp->private_data = hpriv;
hpriv->filp = filp; hpriv->filp = filp;
hpriv->notifier_event.events_mask = 0;
hpriv->notifier_event.eventfd = 0;
mutex_init(&hpriv->notifier_event.lock); mutex_init(&hpriv->notifier_event.lock);
mutex_init(&hpriv->restore_phase_mutex); mutex_init(&hpriv->restore_phase_mutex);
...@@ -246,8 +244,6 @@ int hl_device_open_ctrl(struct inode *inode, struct file *filp) ...@@ -246,8 +244,6 @@ int hl_device_open_ctrl(struct inode *inode, struct file *filp)
hpriv->hdev = hdev; hpriv->hdev = hdev;
filp->private_data = hpriv; filp->private_data = hpriv;
hpriv->filp = filp; hpriv->filp = filp;
hpriv->notifier_event.events_mask = 0;
hpriv->notifier_event.eventfd = 0;
mutex_init(&hpriv->notifier_event.lock); mutex_init(&hpriv->notifier_event.lock);
nonseekable_open(inode, filp); nonseekable_open(inode, filp);
......
...@@ -647,7 +647,7 @@ static int eventfd_register(struct hl_fpriv *hpriv, struct hl_info_args *args) ...@@ -647,7 +647,7 @@ static int eventfd_register(struct hl_fpriv *hpriv, struct hl_info_args *args)
hpriv->notifier_event.eventfd = eventfd_ctx_fdget(args->eventfd); hpriv->notifier_event.eventfd = eventfd_ctx_fdget(args->eventfd);
if (IS_ERR(hpriv->notifier_event.eventfd)) { if (IS_ERR(hpriv->notifier_event.eventfd)) {
rc = PTR_ERR(hpriv->notifier_event.eventfd); rc = PTR_ERR(hpriv->notifier_event.eventfd);
hpriv->notifier_event.eventfd = 0; hpriv->notifier_event.eventfd = NULL;
mutex_unlock(&hpriv->notifier_event.lock); mutex_unlock(&hpriv->notifier_event.lock);
return rc; return rc;
} }
...@@ -665,7 +665,7 @@ static int eventfd_unregister(struct hl_fpriv *hpriv, struct hl_info_args *args) ...@@ -665,7 +665,7 @@ static int eventfd_unregister(struct hl_fpriv *hpriv, struct hl_info_args *args)
} }
eventfd_ctx_put(hpriv->notifier_event.eventfd); eventfd_ctx_put(hpriv->notifier_event.eventfd);
hpriv->notifier_event.eventfd = 0; hpriv->notifier_event.eventfd = NULL;
mutex_unlock(&hpriv->notifier_event.lock); mutex_unlock(&hpriv->notifier_event.lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment