diff mbox

[08/26] cpu_cooling: Pass variable instead of its type to sizeof()

Message ID 1a0d2430eb52b55fdb8f82c4cbbb8b4038a105ec.1417167599.git.viresh.kumar@linaro.org (mailing list archive)
State Changes Requested
Delegated to: Eduardo Valentin
Headers show

Commit Message

Viresh Kumar Nov. 28, 2014, 9:44 a.m. UTC
Just following coding guidelines here.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/thermal/cpu_cooling.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Javi Merino Dec. 2, 2014, 3:26 p.m. UTC | #1
Hi Viresh,

On Fri, Nov 28, 2014 at 09:44:02AM +0000, Viresh Kumar wrote:
> Just following coding guidelines here.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/thermal/cpu_cooling.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index def0f21..59725d8 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -468,8 +468,7 @@ __cpufreq_cooling_register(struct device_node *np,
>  				return ERR_PTR(-EINVAL);
>  		}
>  	}
> -	cpufreq_dev = kzalloc(sizeof(struct cpufreq_cooling_device),
> -			      GFP_KERNEL);
> +	cpufreq_dev = kzalloc(sizeof(*cool_dev), GFP_KERNEL);

This should be:

+	cpufreq_dev = kzalloc(sizeof(*cpufreq_dev), GFP_KERNEL);

Cheers,
Javi

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eduardo Valentin Dec. 2, 2014, 11:07 p.m. UTC | #2
Hi,

On Tue, Dec 02, 2014 at 03:26:24PM +0000, Javi Merino wrote:
> Hi Viresh,
> 
> On Fri, Nov 28, 2014 at 09:44:02AM +0000, Viresh Kumar wrote:
> > Just following coding guidelines here.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> >  drivers/thermal/cpu_cooling.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> > index def0f21..59725d8 100644
> > --- a/drivers/thermal/cpu_cooling.c
> > +++ b/drivers/thermal/cpu_cooling.c
> > @@ -468,8 +468,7 @@ __cpufreq_cooling_register(struct device_node *np,
> >  				return ERR_PTR(-EINVAL);
> >  		}
> >  	}
> > -	cpufreq_dev = kzalloc(sizeof(struct cpufreq_cooling_device),
> > -			      GFP_KERNEL);
> > +	cpufreq_dev = kzalloc(sizeof(*cool_dev), GFP_KERNEL);
> 
> This should be:
> 
> +	cpufreq_dev = kzalloc(sizeof(*cpufreq_dev), GFP_KERNEL);

Agreed.

> 
> Cheers,
> Javi
>
Viresh Kumar Dec. 3, 2014, 4:38 a.m. UTC | #3
On 3 December 2014 at 04:37, Eduardo Valentin <edubezval@gmail.com> wrote:
>> This should be:
>>
>> +     cpufreq_dev = kzalloc(sizeof(*cpufreq_dev), GFP_KERNEL);

This is insulting now. So stupid mistake..
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index def0f21..59725d8 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -468,8 +468,7 @@  __cpufreq_cooling_register(struct device_node *np,
 				return ERR_PTR(-EINVAL);
 		}
 	}
-	cpufreq_dev = kzalloc(sizeof(struct cpufreq_cooling_device),
-			      GFP_KERNEL);
+	cpufreq_dev = kzalloc(sizeof(*cool_dev), GFP_KERNEL);
 	if (!cpufreq_dev)
 		return ERR_PTR(-ENOMEM);