public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* re: drm/tegra: sor: Implement sor1_brick clock
@ 2016-07-01 20:58 Dan Carpenter
  2016-07-14 12:56 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-01 20:58 UTC (permalink / raw)
  To: treding-DDmLM1+adcrQT0dZR+AlfA; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hello Thierry Reding,

The patch a7ba8310c7f5: "drm/tegra: sor: Implement sor1_brick clock"
from Oct 1, 2015, leads to the following static checker warning:

	drivers/gpu/drm/tegra/sor.c:318 tegra_clk_sor_brick_get_parent()
	warn: assigning (-22) to unsigned variable 'parent'

drivers/gpu/drm/tegra/sor.c
   314  static u8 tegra_clk_sor_brick_get_parent(struct clk_hw *hw)
               ^^
returns u8.

   315  {
   316          struct tegra_clk_sor_brick *brick = to_brick(hw);
   317          struct tegra_sor *sor = brick->sor;
   318          u8 parent = -EINVAL;
                ^^^^^^^^^^^^^^^^^^^
can't be -EINVAL.

   319          u32 value;
   320  
   321          value = tegra_sor_readl(sor, SOR_CLK_CNTRL);
   322  
   323          switch (value & SOR_CLK_CNTRL_DP_CLK_SEL_MASK) {
   324          case SOR_CLK_CNTRL_DP_CLK_SEL_SINGLE_PCLK:
   325          case SOR_CLK_CNTRL_DP_CLK_SEL_DIFF_PCLK:
   326                  parent = 0;
   327                  break;
   328  
   329          case SOR_CLK_CNTRL_DP_CLK_SEL_SINGLE_DPCLK:
   330          case SOR_CLK_CNTRL_DP_CLK_SEL_DIFF_DPCLK:
   331                  parent = 1;
   332                  break;
   333          }
   334  
   335          return parent;
   336  }

regards,
dan carpenter

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

* Re: drm/tegra: sor: Implement sor1_brick clock
  2016-07-01 20:58 drm/tegra: sor: Implement sor1_brick clock Dan Carpenter
@ 2016-07-14 12:56 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2016-07-14 12:56 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

On Fri, Jul 01, 2016 at 11:58:13PM +0300, Dan Carpenter wrote:
> Hello Thierry Reding,
> 
> The patch a7ba8310c7f5: "drm/tegra: sor: Implement sor1_brick clock"
> from Oct 1, 2015, leads to the following static checker warning:
> 
> 	drivers/gpu/drm/tegra/sor.c:318 tegra_clk_sor_brick_get_parent()
> 	warn: assigning (-22) to unsigned variable 'parent'
> 
> drivers/gpu/drm/tegra/sor.c
>    314  static u8 tegra_clk_sor_brick_get_parent(struct clk_hw *hw)
>                ^^
> returns u8.
> 
>    315  {
>    316          struct tegra_clk_sor_brick *brick = to_brick(hw);
>    317          struct tegra_sor *sor = brick->sor;
>    318          u8 parent = -EINVAL;

This ultimately has the effect of setting u8 to 0xff, which is the most
natural value to signify that the parent is invalid. But yeah, it's not
nice to rely on this behaviour, so I've used U8_MAX instead now.

Thanks,
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-07-14 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01 20:58 drm/tegra: sor: Implement sor1_brick clock Dan Carpenter
2016-07-14 12:56 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox