|
@@ -318,7 +318,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
|
|
return ERR_PTR(-ENODEV);
|
|
return ERR_PTR(-ENODEV);
|
|
}
|
|
}
|
|
|
|
|
|
- chan = NULL;
|
|
|
|
|
|
+ chan = ERR_PTR(-EPROBE_DEFER);
|
|
list_for_each_entry(mbox, &mbox_cons, node)
|
|
list_for_each_entry(mbox, &mbox_cons, node)
|
|
if (mbox->dev->of_node == spec.np) {
|
|
if (mbox->dev->of_node == spec.np) {
|
|
chan = mbox->of_xlate(mbox, &spec);
|
|
chan = mbox->of_xlate(mbox, &spec);
|
|
@@ -327,7 +327,12 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
|
|
|
|
|
|
of_node_put(spec.np);
|
|
of_node_put(spec.np);
|
|
|
|
|
|
- if (!chan || chan->cl || !try_module_get(mbox->dev->driver->owner)) {
|
|
|
|
|
|
+ if (IS_ERR(chan)) {
|
|
|
|
+ mutex_unlock(&con_mutex);
|
|
|
|
+ return chan;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (chan->cl || !try_module_get(mbox->dev->driver->owner)) {
|
|
dev_dbg(dev, "%s: mailbox not free\n", __func__);
|
|
dev_dbg(dev, "%s: mailbox not free\n", __func__);
|
|
mutex_unlock(&con_mutex);
|
|
mutex_unlock(&con_mutex);
|
|
return ERR_PTR(-EBUSY);
|
|
return ERR_PTR(-EBUSY);
|
|
@@ -390,7 +395,7 @@ of_mbox_index_xlate(struct mbox_controller *mbox,
|
|
int ind = sp->args[0];
|
|
int ind = sp->args[0];
|
|
|
|
|
|
if (ind >= mbox->num_chans)
|
|
if (ind >= mbox->num_chans)
|
|
- return NULL;
|
|
|
|
|
|
+ return ERR_PTR(-EINVAL);
|
|
|
|
|
|
return &mbox->chans[ind];
|
|
return &mbox->chans[ind];
|
|
}
|
|
}
|