Re: [PATCH] rpmsg: qcom_smd: Fix uninitialized return variable in __qcom_smd_send()

From: Dan Carpenter
Date: Thu May 08 2025 - 02:40:39 EST


Hi Greg,

I'm sorry I forgot to add the:

Cc: stable@xxxxxxxxxxxxxxx

to this patch. Could we backport it to stable, please?

regards,
dan carpenter

On Wed, Apr 23, 2025 at 08:22:05PM +0300, Dan Carpenter wrote:
> The "ret" variable isn't initialized if we don't enter the loop. For
> example, if "channel->state" is not SMD_CHANNEL_OPENED.
>
> Fixes: 33e3820dda88 ("rpmsg: smd: Use spinlock in tx path")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> Naresh, could you test this patch and see if it fixes the boot
> problems you saw?
>
> drivers/rpmsg/qcom_smd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
> index 40d386809d6b..bb161def3175 100644
> --- a/drivers/rpmsg/qcom_smd.c
> +++ b/drivers/rpmsg/qcom_smd.c
> @@ -746,7 +746,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
> __le32 hdr[5] = { cpu_to_le32(len), };
> int tlen = sizeof(hdr) + len;
> unsigned long flags;
> - int ret;
> + int ret = 0;
>
> /* Word aligned channels only accept word size aligned data */
> if (channel->info_word && len % 4)
> --
> 2.47.2