Re: [PATCH v3] fpga: stratix10-soc: Fix SVC mailbox handling during reconfiguration

From: Xu Yilun

Date: Fri Jun 26 2026 - 13:11:59 EST


> @@ -195,20 +195,20 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
> ret = s10_svc_send_msg(priv, COMMAND_RECONFIG,
> &ctype, sizeof(ctype));
> if (ret < 0)
> - goto init_done;
> + goto init_error;
>
> ret = wait_for_completion_timeout(
> &priv->status_return_completion, S10_RECONFIG_TIMEOUT);
> if (!ret) {
> dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
> ret = -ETIMEDOUT;
> - goto init_done;
> + goto init_error;
> }
>
> ret = 0;

Why re-initialize ret here?

> if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
> ret = -ETIMEDOUT;
> - goto init_done;
> + goto init_error;
> }
>
> /* Allocate buffers from the service layer's pool. */
> @@ -216,16 +216,19 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
> kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE);
> if (IS_ERR(kbuf)) {
> s10_free_buffers(mgr);
> - ret = PTR_ERR(kbuf);
> - goto init_done;
> + ret = -ENOMEM;

Why change the ret?

> + goto init_error;
> }
>
> priv->svc_bufs[i].buf = kbuf;
> priv->svc_bufs[i].lock = 0;
> }
>
> -init_done:
> + goto init_done;

Happy path? why not just return 0; And you don't need init_done at all.

> +
> +init_error:
> stratix10_svc_done(priv->chan);
> +init_done:
> return ret;
> }