linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] clk: uniphier: add core support code for UniPhier clock driver
@ 2016-10-12  9:34 Dan Carpenter
  2016-10-13  5:47 ` Masahiro Yamada
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2016-10-12  9:34 UTC (permalink / raw)
  To: yamada.masahiro; +Cc: linux-clk

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-01  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12  9:34 [bug report] clk: uniphier: add core support code for UniPhier clock driver Dan Carpenter
2016-10-13  5:47 ` Masahiro Yamada
2016-10-28  1:28   ` Stephen Boyd
2016-11-01  6:50     ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).