linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: Allocate memory using the right data type
@ 2014-07-16  3:10 Saravana Kannan
  2014-07-16  3:33 ` Greg Kroah-Hartman
  2014-07-16 17:21 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Saravana Kannan @ 2014-07-16  3:10 UTC (permalink / raw)
  To: MyungJoo Ham, Kyungmin Park, Greg Kroah-Hartman
  Cc: Suman Tatiraju, linux-pm, stable, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Saravana Kannan

From: Suman Tatiraju <sumant@codeaurora.org>

Long and int have different sizes on a 64-bit machine. Allocate
memory for the time_in_state table using the right data type.

Change-Id: I335277674018c0ea759aa0996309d52578ea1fd5
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Reviewed-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
---
 drivers/devfreq/devfreq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 65eed38..349e28ea 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -483,9 +483,10 @@ struct devfreq *devfreq_add_device(struct device *dev,
 						devfreq->profile->max_state *
 						devfreq->profile->max_state,
 						GFP_KERNEL);
-	devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) *
-						devfreq->profile->max_state,
-						GFP_KERNEL);
+	devfreq->time_in_state = devm_kzalloc(dev,
+					sizeof(*(devfreq->time_in_state)) *
+					devfreq->profile->max_state,
+					GFP_KERNEL);
 	devfreq->last_stat_updated = jiffies;
 
 	dev_set_name(&devfreq->dev, "%s", dev_name(dev));
-- 
1.8.2.1

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH] PM / devfreq: Allocate memory using the right data type
  2014-07-16  3:10 [PATCH] PM / devfreq: Allocate memory using the right data type Saravana Kannan
@ 2014-07-16  3:33 ` Greg Kroah-Hartman
  2014-07-16 17:21 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-16  3:33 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: MyungJoo Ham, Kyungmin Park, Suman Tatiraju, linux-pm, stable,
	linux-kernel, linux-arm-msm, linux-arm-kernel

On Tue, Jul 15, 2014 at 08:10:43PM -0700, Saravana Kannan wrote:
> From: Suman Tatiraju <sumant@codeaurora.org>
> 
> Long and int have different sizes on a 64-bit machine. Allocate
> memory for the time_in_state table using the right data type.
> 
> Change-Id: I335277674018c0ea759aa0996309d52578ea1fd5

Please don't put this crud in patches you submit upstream.  It means
nothing to us.

> Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
> Reviewed-by: Saravana Kannan <skannan@codeaurora.org>
> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
> ---
>  drivers/devfreq/devfreq.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

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

* Re: [PATCH] PM / devfreq: Allocate memory using the right data type
  2014-07-16  3:10 [PATCH] PM / devfreq: Allocate memory using the right data type Saravana Kannan
  2014-07-16  3:33 ` Greg Kroah-Hartman
@ 2014-07-16 17:21 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2014-07-16 17:21 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: MyungJoo Ham, Kyungmin Park, Greg Kroah-Hartman, Suman Tatiraju,
	linux-pm, stable, linux-kernel, linux-arm-msm, linux-arm-kernel

On 07/15/14 20:10, Saravana Kannan wrote:
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 65eed38..349e28ea 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -483,9 +483,10 @@ struct devfreq *devfreq_add_device(struct device *dev,
>  						devfreq->profile->max_state *
>  						devfreq->profile->max_state,
>  						GFP_KERNEL);
> -	devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) *
> -						devfreq->profile->max_state,
> -						GFP_KERNEL);
> +	devfreq->time_in_state = devm_kzalloc(dev,
> +					sizeof(*(devfreq->time_in_state)) *
> +					devfreq->profile->max_state,
> +					GFP_KERNEL);

We could use devm_kcalloc() here too.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


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

end of thread, other threads:[~2014-07-16 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16  3:10 [PATCH] PM / devfreq: Allocate memory using the right data type Saravana Kannan
2014-07-16  3:33 ` Greg Kroah-Hartman
2014-07-16 17:21 ` Stephen Boyd

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