[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9upwNAzXzSxmiFo@kadam>
Date: Thu, 2 Feb 2023 15:17:04 +0300
From: Dan Carpenter <error27@...il.com>
To: Trevor Wu <trevor.wu@...iatek.com>
Cc: broonie@...nel.org, lgirdwood@...il.com, tiwai@...e.com,
perex@...ex.cz, matthias.bgg@...il.com,
alsa-devel@...a-project.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: mediatek: mt8188: remove etdm dead code
On Thu, Feb 02, 2023 at 06:37:04PM +0800, Trevor Wu wrote:
> Some Smatch static checker warning like below was found.
>
> sound/soc/mediatek/mt8188/mt8188-dai-etdm.c:2487
> mt8188_dai_etdm_parse_of()
> warn: 'ret' returned from snprintf() might be larger than 48
>
> 2479 for (i = 0; i < MT8188_AFE_IO_ETDM_NUM; i++) {
> 2480 dai_id = ETDM_TO_DAI_ID(i);
> 2481 etdm_data = afe_priv->dai_priv[dai_id];
> 2482
> 2483 ret = snprintf(prop, sizeof(prop),
> 2484 "mediatek,%s-multi-pin-mode",
> 2485 of_afe_etdms[i].name);
> 2486 if (ret < 0) {
> --> 2487 dev_err(afe->dev, "%s snprintf
> err=%d\n",
> 2488
>
> In linux kernel, snprintf() never returns negatives. On the other hand,
> the format string like "mediatek,%s-multi-pin-mode" must be smaller
> than sizeof(prop)=48.
>
> After discussing in the mail thread[1], I remove the dead code to fix
> the Smatch warnings.
>
> [1]: https://lore.kernel.org/all/Y9EdBg641tJDDrt%2F@kili/
>
> Signed-off-by: Trevor Wu <trevor.wu@...iatek.com>
> ---
Thanks!
Regards,
dan carpenter
Powered by blists - more mailing lists