linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-pm@vger.kernel.org
Subject: Re: PM / OPP: Add clock-latency-ns support
Date: Tue, 11 Aug 2015 13:42:28 +0530	[thread overview]
Message-ID: <20150811081228.GC5509@linux> (raw)
In-Reply-To: <20150810163804.GA10496@mwanda>

On 10-08-15, 19:38, Dan Carpenter wrote:
> Hello Viresh Kumar,
> 
> The patch 3ca9bb33c627: "PM / OPP: Add clock-latency-ns support" from
> Jul 29, 2015, leads to the following static checker warning:
> 
> 	drivers/base/power/opp.c:949 _opp_add_static_v2()
> 	warn: passing casted pointer '&new_opp->clock_latency_ns' to 'of_property_read_u32()' 64 vs 32.
> 
> drivers/base/power/opp.c
>    946          new_opp->np = np;
>    947          new_opp->dynamic = false;
>    948          new_opp->available = true;
>    949          of_property_read_u32(np, "clock-latency-ns",
>    950                               (u32 *)&new_opp->clock_latency_ns);
>                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> This code will break on 64 bit, big endian machines.  I doin't know if
> that is an issue for this driver.  I saw this was in the power/
> directory and I spent a minute googling to see if PowerPC machines are
> big endian...  :P
> 
>    951  
>    952          ret = opp_get_microvolt(new_opp, dev);
>    953          if (ret)
>    954                  goto free_opp;
>    955  
> 
> Also:
> 
> 	drivers/base/power/opp.c:956 _opp_add_static_v2()
> 	warn: passing casted pointer '&new_opp->u_amp' to 'of_property_read_u32()' 64 vs 32.

Hi Dan,

The problem is that the value here is of type 'unsigned long' which is
32/64 bit on 32/64 bit machines.

So, I looked at how other places in code has done it, and that's what
I found.

-- 
viresh

  reply	other threads:[~2015-08-11  8:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 16:38 PM / OPP: Add clock-latency-ns support Dan Carpenter
2015-08-11  8:12 ` Viresh Kumar [this message]
2015-08-11 13:53   ` Dan Carpenter
2015-08-11 18:54     ` Stephen Boyd
2015-08-12  6:57       ` Viresh Kumar
2015-08-12  7:58         ` Dan Carpenter

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=20150811081228.GC5509@linux \
    --to=viresh.kumar@linaro.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    /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;
as well as URLs for NNTP newsgroup(s).