All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ben Levinsky" <ben.levinsky@amd.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v3 5/5] remoteproc: switch drivers to optional resource-table helper
Date: Fri, 29 May 2026 04:42:06 +0000	[thread overview]
Message-ID: <20260529044206.C4A7F1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260529021637.2077602-6-ben.levinsky@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `rproc_elf_load_rsc_table_optional` macro hides unconditional function returns, making the trailing `return 0;` in all calling functions unreachable.
- [Medium] Undocumented change in error propagation for multiple drivers which previously ignored non-EINVAL errors.
--

commit 9602dbc4d243a49c62f52f899683404a0f547124
Author: Ben Levinsky <ben.levinsky@amd.com>

remoteproc: switch drivers to optional resource-table helper

This commit updates several remoteproc drivers to use the new shared
rproc_elf_load_rsc_table_optional() helper for handling optional resource
tables.

> Keep thin local parse_fw() wrappers in each driver so the helper only
> centralizes the return-value handling while each platform retains
> control over whether the missing-table case is logged and at
> what severity.

[Severity: Medium]
Is this description entirely accurate? Prior to this patch, drivers like
imx_dsp_rproc and rcar_rproc completely ignored all errors from
rproc_elf_load_rsc_table() and unconditionally returned 0.

The new rproc_elf_load_rsc_table_optional() macro propagates non--EINVAL
errors (such as -ENOMEM). While this propagation is likely a functional
improvement, it is a behavior change for these drivers rather than just
centralizing the return-value handling. Should this change in error
propagation be explicitly documented in the commit message?

> diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
> index 2d9f14fbef1da..fd60c67ba8a9f 100644
> --- a/drivers/remoteproc/imx_dsp_rproc.c
> +++ b/drivers/remoteproc/imx_dsp_rproc.c
> @@ -956,9 +956,8 @@ static int imx_dsp_rproc_elf_load_segments(struct rproc *rproc, const struct fir
>  
>  static int imx_dsp_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
>  {
> -	if (rproc_elf_load_rsc_table(rproc, fw))
> -		dev_warn(&rproc->dev, "no resource table found for this firmware\n");
> -
> +	rproc_elf_load_rsc_table_optional(rproc, fw, dev_warn,
> +					  "no resource table found for this firmware\n");
>  	return 0;

[Severity: Medium]
Does this leave the trailing 'return 0;' unreachable?

Looking at the definition of rproc_elf_load_rsc_table_optional() in
drivers/remoteproc/remoteproc_internal.h:

#define rproc_elf_load_rsc_table_optional(rproc, fw, dev_func, fmt, ...) \
    ({                                                                   \
        int ret = rproc_elf_load_rsc_table(rproc, fw);                   \
        if (ret == -EINVAL) {                                            \
            dev_func(&rproc->dev, fmt, ##__VA_ARGS__);                   \
            return 0;                                                    \
        } else {                                                         \
            return ret;                                                  \
        }                                                                \
    })

Because the macro uses explicit return statements within the statement
expression, it exits the enclosing function entirely. This hides the control
flow and renders the trailing 'return 0;' dead code in every driver modified
by this patch.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260529021637.2077602-1-ben.levinsky@amd.com?part=5

  reply	other threads:[~2026-05-29  4:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  2:16 [PATCH v3 0/5] remoteproc: cleanup shared carveout and resource-table helpers Ben Levinsky
2026-05-29  2:16 ` [PATCH v3 1/5] remoteproc: add common wc-ioremap carveout callbacks Ben Levinsky
2026-05-29  2:51   ` sashiko-bot
2026-05-29  2:16 ` [PATCH v3 2/5] remoteproc: switch exact-match drivers to wc-ioremap callbacks Ben Levinsky
2026-05-29  3:34   ` sashiko-bot
2026-05-29  2:16 ` [PATCH v3 3/5] remoteproc: mark wc-ioremap carveouts as iomem Ben Levinsky
2026-05-29  4:16   ` sashiko-bot
2026-05-29  2:16 ` [PATCH v3 4/5] remoteproc: add helper for optional ELF resource tables Ben Levinsky
2026-05-29  4:31   ` sashiko-bot
2026-05-29  2:16 ` [PATCH v3 5/5] remoteproc: switch drivers to optional resource-table helper Ben Levinsky
2026-05-29  4:42   ` sashiko-bot [this message]
2026-05-29  8:42 ` [PATCH v3 0/5] remoteproc: cleanup shared carveout and resource-table helpers Wolfram Sang
2026-06-01 14:42 ` Mathieu Poirier
2026-06-06  3:43   ` Peng Fan

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=20260529044206.C4A7F1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=ben.levinsky@amd.com \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.