Linux clock framework development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: yamada.masahiro@socionext.com
Cc: linux-clk@vger.kernel.org
Subject: [bug report] clk: uniphier: add core support code for UniPhier clock driver
Date: Wed, 12 Oct 2016 12:34:04 +0300	[thread overview]
Message-ID: <20161012093404.GA29062@mwanda> (raw)

Hello Masahiro Yamada,

The patch 734d82f4a678: "clk: uniphier: add core support code for
UniPhier clock driver" from Sep 16, 2016, leads to the following
static checker warning:

	drivers/clk/uniphier/clk-uniphier-mux.c:56 uniphier_clk_mux_get_parent()
	warn: signedness bug returning '(-22)'

drivers/clk/uniphier/clk-uniphier-mux.c
    40  static u8 uniphier_clk_mux_get_parent(struct clk_hw *hw)
               ^^
    41  {
    42          struct uniphier_clk_mux *mux = to_uniphier_clk_mux(hw);
    43          int num_parents = clk_hw_get_num_parents(hw);
    44          int ret;
    45          u32 val;
    46          u8 i;
    47  
    48          ret = regmap_read(mux->regmap, mux->reg, &val);
    49          if (ret)
    50                  return ret;
    51  
    52          for (i = 0; i < num_parents; i++)
    53                  if ((mux->masks[i] & val) == mux->vals[i])
    54                          return i;
    55  
    56          return -EINVAL;
                       ^^^^^^^

We can't return -EINVAL as a u8.

    57  }

There are a bunch of similar bugs:

drivers/clk/samsung/clk-s3c2410-dclk.c:72 s3c24xx_clkout_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/uniphier/clk-uniphier-mux.c:56 uniphier_clk_mux_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/microchip/clk-core.c:296 roclk_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/microchip/clk-core.c:837 sclk_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/ti/mux.c:51 ti_clk_mux_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/ti/mux.c:61 ti_clk_mux_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/nxp/clk-lpc32xx.c:1018 clk_mux_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/nxp/clk-lpc32xx.c:1022 clk_mux_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/rockchip/clk-ddr.c:91 rockchip_ddrclk_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/clk-mux.c:51 clk_mux_get_parent() warn: signedness bug returning '(-22)'
drivers/clk/clk-mux.c:61 clk_mux_get_parent() warn: signedness bug returning '(-22)'

regards,
dan carpenter

             reply	other threads:[~2016-10-12 11:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12  9:34 Dan Carpenter [this message]
2016-10-13  5:47 ` [bug report] clk: uniphier: add core support code for UniPhier clock driver Masahiro Yamada
2016-10-28  1:28   ` Stephen Boyd
2016-11-01  6:50     ` Masahiro Yamada

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=20161012093404.GA29062@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox