From: Beleswar Prasad Padhi <b-padhi@ti.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>
Subject: Re: [bug report] remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
Date: Mon, 6 May 2024 19:56:35 +0530 [thread overview]
Message-ID: <a9f75b4f-a5ce-4c0c-8406-f0646ad36144@ti.com> (raw)
In-Reply-To: <acc4f7a0-3bb5-4842-95a5-fb3c3fc8554b@moroto.mountain>
Hello Dan,
On 03/05/24 20:54, Dan Carpenter wrote:
> Hello Beleswar Padhi,
>
> Commit 3c8a9066d584 ("remoteproc: k3-r5: Do not allow core1 to power
> up before core0 via sysfs") from Apr 30, 2024 (linux-next), leads to
> the following Smatch static checker warning:
>
> drivers/remoteproc/ti_k3_r5_remoteproc.c:583 k3_r5_rproc_start()
> warn: missing unwind goto?
>
> drivers/remoteproc/ti_k3_r5_remoteproc.c:651 k3_r5_rproc_stop()
> warn: missing unwind goto?
>
> drivers/remoteproc/ti_k3_r5_remoteproc.c
> 546 static int k3_r5_rproc_start(struct rproc *rproc)
> 547 {
> 548 struct k3_r5_rproc *kproc = rproc->priv;
> 549 struct k3_r5_cluster *cluster = kproc->cluster;
> 550 struct device *dev = kproc->dev;
> 551 struct k3_r5_core *core0, *core;
> 552 u32 boot_addr;
> 553 int ret;
> 554
> 555 ret = k3_r5_rproc_request_mbox(rproc);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> 556 if (ret)
> 557 return ret;
> 558
> 559 boot_addr = rproc->bootaddr;
> 560 /* TODO: add boot_addr sanity checking */
> 561 dev_dbg(dev, "booting R5F core using boot addr = 0x%x\n", boot_addr);
> 562
> 563 /* boot vector need not be programmed for Core1 in LockStep mode */
> 564 core = kproc->core;
> 565 ret = ti_sci_proc_set_config(core->tsp, boot_addr, 0, 0);
> 566 if (ret)
> 567 goto put_mbox;
> 568
> 569 /* unhalt/run all applicable cores */
> 570 if (cluster->mode == CLUSTER_MODE_LOCKSTEP) {
> 571 list_for_each_entry_reverse(core, &cluster->cores, elem) {
> 572 ret = k3_r5_core_run(core);
> 573 if (ret)
> 574 goto unroll_core_run;
> 575 }
> 576 } else {
> 577 /* do not allow core 1 to start before core 0 */
> 578 core0 = list_first_entry(&cluster->cores, struct k3_r5_core,
> 579 elem);
> 580 if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
> 581 dev_err(dev, "%s: can not start core 1 before core 0\n",
> 582 __func__);
> --> 583 return -EPERM;
>
> Is there no clean up on this error path? I think we need to do a
> goto put_mbox at least.
Thank you for pointing out. Apologies for the oversight. I have sent a
PATCH addressing this bug.
Link to PATCH:
https://lore.kernel.org/all/20240506141849.1735679-1-b-padhi@ti.com/
Regards,
Beleswar
>
> 584 }
> 585
> 586 ret = k3_r5_core_run(core);
> 587 if (ret)
> 588 goto put_mbox;
> 589 }
> 590
> 591 return 0;
> 592
> 593 unroll_core_run:
> 594 list_for_each_entry_continue(core, &cluster->cores, elem) {
> 595 if (k3_r5_core_halt(core))
> 596 dev_warn(core->dev, "core halt back failed\n");
> 597 }
> 598 put_mbox:
> 599 mbox_free_channel(kproc->mbox);
> 600 return ret;
> 601 }
>
> regards,
> dan carpenter
>
prev parent reply other threads:[~2024-05-06 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 15:24 [bug report] remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs Dan Carpenter
2024-05-06 14:26 ` Beleswar Prasad Padhi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9f75b4f-a5ce-4c0c-8406-f0646ad36144@ti.com \
--to=b-padhi@ti.com \
--cc=dan.carpenter@linaro.org \
--cc=linux-remoteproc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).