summaryrefslogtreecommitdiff
path: root/drivers/mailbox
diff options
context:
space:
mode:
authorIbai Erkiaga <ibai.erkiaga-elorza@xilinx.com>2019-09-27 11:36:54 +0100
committerMichal Simek <michal.simek@xilinx.com>2019-10-08 09:55:11 +0200
commit22673b4d53fc5ad82f632d6cdaae2950190ef214 (patch)
tree145b9491cb997dfc8be6e0196f451451776405e0 /drivers/mailbox
parentff1b0da4edfe58c08055816f34337e375dfff486 (diff)
downloadu-boot-22673b4d53fc5ad82f632d6cdaae2950190ef214.tar.gz
u-boot-22673b4d53fc5ad82f632d6cdaae2950190ef214.tar.bz2
u-boot-22673b4d53fc5ad82f632d6cdaae2950190ef214.zip
mailbox: check ops prior calling
Check if request and free operations are present prior calling to the functions. Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/mailbox-uclass.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c
index 1b4a5863c9..809f26b202 100644
--- a/drivers/mailbox/mailbox-uclass.c
+++ b/drivers/mailbox/mailbox-uclass.c
@@ -63,7 +63,8 @@ int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan)
return ret;
}
- ret = ops->request(chan);
+ if (ops->request)
+ ret = ops->request(chan);
if (ret) {
debug("ops->request() failed: %d\n", ret);
return ret;
@@ -94,7 +95,10 @@ int mbox_free(struct mbox_chan *chan)
debug("%s(chan=%p)\n", __func__, chan);
- return ops->free(chan);
+ if (ops->free)
+ return ops->free(chan);
+
+ return 0;
}
int mbox_send(struct mbox_chan *chan, const void *data)