Commit c2192bbc authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: bus: deinitialize callback functions on init failure

If the initialization procedure for receive or receive callback
registration on the client bus has failed the caller can't re-run it.
Deinitilize the callback pointers and cancel the work
to allow the caller to retry.
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20201029095444.957924-4-tomas.winkler@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c7a6252b
...@@ -370,8 +370,11 @@ int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb) ...@@ -370,8 +370,11 @@ int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb)
else else
ret = -ENODEV; ret = -ENODEV;
mutex_unlock(&bus->device_lock); mutex_unlock(&bus->device_lock);
if (ret && ret != -EBUSY) if (ret && ret != -EBUSY) {
cancel_work_sync(&cldev->rx_work);
cldev->rx_cb = NULL;
return ret; return ret;
}
return 0; return 0;
} }
...@@ -405,8 +408,11 @@ int mei_cldev_register_notif_cb(struct mei_cl_device *cldev, ...@@ -405,8 +408,11 @@ int mei_cldev_register_notif_cb(struct mei_cl_device *cldev,
mutex_lock(&bus->device_lock); mutex_lock(&bus->device_lock);
ret = mei_cl_notify_request(cldev->cl, NULL, 1); ret = mei_cl_notify_request(cldev->cl, NULL, 1);
mutex_unlock(&bus->device_lock); mutex_unlock(&bus->device_lock);
if (ret) if (ret) {
cancel_work_sync(&cldev->notif_work);
cldev->notif_cb = NULL;
return ret; return ret;
}
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