diff options
author | Eric Anholt <eric@anholt.net> | 2015-06-23 17:01:19 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2015-06-23 17:01:27 -0700 |
commit | d0d5beea146588ac94b08bd48496987191d76568 (patch) | |
tree | 719ad1b5af342aec1597ded7465439e70dacc6b4 /drivers/mailbox/mailbox.c | |
parent | d9fa11803a0d2e3b1eaf4041ddd0ca5651300d96 (diff) | |
parent | 56d1015c668327beefaf8142b0f83960437052c7 (diff) | |
download | linux-d0d5beea146588ac94b08bd48496987191d76568.tar.gz |
Merge remote-tracking branch vc4-kms-v3d' into vc4-kms-v3d-rpi2
Diffstat (limited to 'drivers/mailbox/mailbox.c')
-rw-r--r-- | drivers/mailbox/mailbox.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 19b491d2964f..c3c42d42d017 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -318,7 +318,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) return ERR_PTR(-ENODEV); } - chan = NULL; + chan = ERR_PTR(-EPROBE_DEFER); list_for_each_entry(mbox, &mbox_cons, node) if (mbox->dev->of_node == spec.np) { 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); - 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__); mutex_unlock(&con_mutex); return ERR_PTR(-EBUSY); @@ -390,7 +395,7 @@ of_mbox_index_xlate(struct mbox_controller *mbox, int ind = sp->args[0]; if (ind >= mbox->num_chans) - return NULL; + return ERR_PTR(-EINVAL); return &mbox->chans[ind]; } |