firmware: turris-mox-rwtm: Initialize completion before mailbox
authorMarek Behún <kabel@kernel.org>
Mon, 15 Jul 2024 11:59:12 +0000 (13:59 +0200)
committerArnd Bergmann <arnd@arndb.de>
Mon, 15 Jul 2024 14:57:57 +0000 (16:57 +0200)
Initialize the completion before the mailbox channel is requested.

Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver")
Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
drivers/firmware/turris-mox-rwtm.c

index 3f4758e03c818d2f0974ba8033e5f7f7bf12efb3..3e7f186d239a2b774fced06a17a9116f3d272318 100644 (file)
@@ -499,6 +499,7 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, rwtm);
 
        mutex_init(&rwtm->busy);
+       init_completion(&rwtm->cmd_done);
 
        rwtm->mbox_client.dev = dev;
        rwtm->mbox_client.rx_callback = mox_rwtm_rx_callback;
@@ -512,8 +513,6 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)
                goto remove_files;
        }
 
-       init_completion(&rwtm->cmd_done);
-
        ret = mox_get_board_info(rwtm);
        if (ret < 0)
                dev_warn(dev, "Cannot read board information: %i\n", ret);