All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kuninori.morimoto.gx@renesas.com
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ASoC: rsnd: adg: clearly handle clock error / NULL case
Date: Tue, 24 Aug 2021 12:29:32 +0300	[thread overview]
Message-ID: <20210824092931.GA22090@kili> (raw)

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

             reply	other threads:[~2021-08-24  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  9:29 Dan Carpenter [this message]
2021-08-24 22:55 ` [bug report] ASoC: rsnd: adg: clearly handle clock error / NULL case Kuninori Morimoto

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=20210824092931.GA22090@kili \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kuninori.morimoto.gx@renesas.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.