* [bug report] ASoC: rsnd: adg: clearly handle clock error / NULL case
@ 2021-08-24 9:29 Dan Carpenter
2021-08-24 22:55 ` Kuninori Morimoto
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-08-24 9:29 UTC (permalink / raw)
To: kuninori.morimoto.gx; +Cc: alsa-devel
Hello Kuninori Morimoto,
The patch cc64c390b215: "ASoC: rsnd: adg: clearly handle clock error
/ NULL case" from Aug 20, 2021, leads to the following
Smatch static checker warning:
sound/soc/sh/rcar/adg.c:396 rsnd_adg_create_null_clk()
warn: passing zero to 'ERR_CAST'
sound/soc/sh/rcar/adg.c
386 static struct clk *rsnd_adg_create_null_clk(struct rsnd_priv *priv,
387 const char * const name,
388 const char *parent)
389 {
390 struct device *dev = rsnd_priv_to_dev(priv);
391 struct clk *clk;
392
393 clk = clk_register_fixed_rate(dev, name, parent, 0, 0);
394 if (IS_ERR_OR_NULL(clk)) {
395 dev_err(dev, "create null clk error\n");
The clk_register_fixed_rate() function doesn't have any documentation,
but generally when functions return a mix of error pointers and NULL
then the NULL case means the feature is deliberately disabled. So it
should not print an error message. Perhaps an info message at most.
--> 396 return ERR_CAST(clk);
No need to cast this. The types are the same.
397 }
398
399 return clk;
400 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] ASoC: rsnd: adg: clearly handle clock error / NULL case
2021-08-24 9:29 [bug report] ASoC: rsnd: adg: clearly handle clock error / NULL case Dan Carpenter
@ 2021-08-24 22:55 ` Kuninori Morimoto
0 siblings, 0 replies; 2+ messages in thread
From: Kuninori Morimoto @ 2021-08-24 22:55 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel
Hi Dan
Thank you for your feedback
> sound/soc/sh/rcar/adg.c:396 rsnd_adg_create_null_clk()
> warn: passing zero to 'ERR_CAST'
(snip)
> The clk_register_fixed_rate() function doesn't have any documentation,
> but generally when functions return a mix of error pointers and NULL
> then the NULL case means the feature is deliberately disabled. So it
> should not print an error message. Perhaps an info message at most.
>
> --> 396 return ERR_CAST(clk);
>
> No need to cast this. The types are the same.
Thanks. Will fix these in next week.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-24 22:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24 9:29 [bug report] ASoC: rsnd: adg: clearly handle clock error / NULL case Dan Carpenter
2021-08-24 22:55 ` Kuninori Morimoto
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.