@@ -479,14 +479,10 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)
if (!rwtm->buf)
return -ENOMEM;
- ret = mox_kobj_create(rwtm);
- if (ret < 0)
- return dev_err_probe(dev, ret,
- "Cannot create turris-mox-rwtm kobject!\n");
-
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;
@@ -505,12 +501,15 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
- init_completion(&rwtm->cmd_done);
-
ret = mox_get_board_info(rwtm);
if (ret < 0)
dev_warn(dev, "Cannot read board information: %i\n", ret);
+ ret = mox_kobj_create(rwtm);
+ if (ret < 0)
+ return dev_err_probe(dev, ret,
+ "Cannot create turris-mox-rwtm kobject!\n");
+
ret = check_get_random_support(rwtm);
if (ret < 0) {
dev_notice(dev,
Rearrange probe calls: - create the kobject (and corresponding sysfs files) only after the mailbox is created and board info is read - initialize the completion before mailbox channel is requested Signed-off-by: Marek Behún <kabel@kernel.org> --- drivers/firmware/turris-mox-rwtm.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)