]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mailbox: don't protect of_parse_phandle_with_args with con_mutex
authorTudor Ambarus <tudor.ambarus@linaro.org>
Mon, 24 Feb 2025 08:27:14 +0000 (08:27 +0000)
committerJassi Brar <jassisinghbrar@gmail.com>
Thu, 27 Mar 2025 01:58:25 +0000 (20:58 -0500)
There are no concurrency problems if multiple consumers parse the
phandle, don't gratuiously protect the parsing with the mutex used
for the controllers list.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
drivers/mailbox/mailbox.c

index cb174e788a96c244c52c2f07f3ffdf103c68d0c2..784b56859a061e97d7ccf612664159d225830955 100644 (file)
@@ -413,16 +413,15 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
                return ERR_PTR(-ENODEV);
        }
 
-       mutex_lock(&con_mutex);
-
        ret = of_parse_phandle_with_args(dev->of_node, "mboxes", "#mbox-cells",
                                         index, &spec);
        if (ret) {
                dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__);
-               mutex_unlock(&con_mutex);
                return ERR_PTR(ret);
        }
 
+       mutex_lock(&con_mutex);
+
        chan = ERR_PTR(-EPROBE_DEFER);
        list_for_each_entry(mbox, &mbox_cons, node)
                if (mbox->dev->of_node == spec.np) {