linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] clk: tegra: Add BPMP clock driver
@ 2016-11-17 12:59 Dan Carpenter
  2016-11-17 17:25 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-11-17 12:59 UTC (permalink / raw)
  To: treding-DDmLM1+adcrQT0dZR+AlfA; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hello Thierry Reding,

The patch 569d53d81e37: "clk: tegra: Add BPMP clock driver" from Aug
18, 2016, leads to the following static checker warning:

	drivers/clk/tegra/clk-bpmp.c:183 tegra_bpmp_clk_get_parent()
	warn: sizeof(&pointer)?

drivers/clk/tegra/clk-bpmp.c
   171  static u8 tegra_bpmp_clk_get_parent(struct clk_hw *hw)
   172  {
   173          struct tegra_bpmp_clk *clk = to_tegra_bpmp_clk(hw);
   174          struct cmd_clk_get_parent_response response;
   175          struct tegra_bpmp_clk_message msg;
   176          unsigned int i;
   177          int err;
   178  
   179          memset(&msg, 0, sizeof(msg));
   180          msg.cmd = CMD_CLK_GET_PARENT;
   181          msg.clk = clk->id;
   182          msg.rx.data = &response;
   183          msg.rx.size = sizeof(&response);

This should almost certainly sizeof(response). int vs pointer.

   184  
   185          err = tegra_bpmp_clk_transfer(clk->bpmp, &msg);
   186          if (err < 0) {
   187                  dev_err(clk->bpmp->dev, "failed to get parent for %s: %d\n",

regards,
dan carpenter

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

* Re: [bug report] clk: tegra: Add BPMP clock driver
  2016-11-17 12:59 [bug report] clk: tegra: Add BPMP clock driver Dan Carpenter
@ 2016-11-17 17:25 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2016-11-17 17:25 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

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

Hi Dan,

On Thu, Nov 17, 2016 at 03:59:54PM +0300, Dan Carpenter wrote:
> Hello Thierry Reding,
> 
> The patch 569d53d81e37: "clk: tegra: Add BPMP clock driver" from Aug
> 18, 2016, leads to the following static checker warning:
> 
> 	drivers/clk/tegra/clk-bpmp.c:183 tegra_bpmp_clk_get_parent()
> 	warn: sizeof(&pointer)?
> 
> drivers/clk/tegra/clk-bpmp.c
>    171  static u8 tegra_bpmp_clk_get_parent(struct clk_hw *hw)
>    172  {
>    173          struct tegra_bpmp_clk *clk = to_tegra_bpmp_clk(hw);
>    174          struct cmd_clk_get_parent_response response;
>    175          struct tegra_bpmp_clk_message msg;
>    176          unsigned int i;
>    177          int err;
>    178  
>    179          memset(&msg, 0, sizeof(msg));
>    180          msg.cmd = CMD_CLK_GET_PARENT;
>    181          msg.clk = clk->id;
>    182          msg.rx.data = &response;
>    183          msg.rx.size = sizeof(&response);
> 
> This should almost certainly sizeof(response). int vs pointer.
> 
>    184  
>    185          err = tegra_bpmp_clk_transfer(clk->bpmp, &msg);
>    186          if (err < 0) {
>    187                  dev_err(clk->bpmp->dev, "failed to get parent for %s: %d\n",

Mike pointed that out during review and I've fixed it since then. I
assume that this worked fine because we were accidentally ovewriting
something on the stack that we no longer used (perhaps the following
msg variable?).

Thanks for reporting,
Thierry

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

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

end of thread, other threads:[~2016-11-17 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-17 12:59 [bug report] clk: tegra: Add BPMP clock driver Dan Carpenter
2016-11-17 17:25 ` Thierry Reding

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).