]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mailbox: check ops prior calling
authorIbai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Fri, 27 Sep 2019 10:36:54 +0000 (11:36 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 8 Oct 2019 07:55:11 +0000 (09:55 +0200)
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>
drivers/mailbox/mailbox-uclass.c

index 1b4a5863c9e5c3a24989e2ca61145e80da996c4e..809f26b2025864d4102bb6fb4c13b8acde29cc9e 100644 (file)
@@ -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)