mei: bus: report if event registration failed
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 23 Jul 2015 12:08:38 +0000 (15:08 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Aug 2015 00:21:58 +0000 (17:21 -0700)
If event registeration has failed, the caller should know
about it.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/bus.c

index 257e200b5343915cec9f3a9b1bf34f4dd6110c9e..aba7688d1dddba790a04c891a5ce884d2842fff1 100644 (file)
@@ -256,6 +256,8 @@ void mei_cl_bus_rx_event(struct mei_cl *cl)
 int mei_cl_register_event_cb(struct mei_cl_device *cldev,
                          mei_cl_event_cb_t event_cb, void *context)
 {
+       int ret;
+
        if (cldev->event_cb)
                return -EALREADY;
 
@@ -264,7 +266,9 @@ int mei_cl_register_event_cb(struct mei_cl_device *cldev,
        cldev->event_context = context;
        INIT_WORK(&cldev->event_work, mei_bus_event_work);
 
-       mei_cl_read_start(cldev->cl, 0, NULL);
+       ret = mei_cl_read_start(cldev->cl, 0, NULL);
+       if (ret && ret != -EBUSY)
+               return ret;
 
        return 0;
 }