[PATCH V2 1/2] mfd: stmpe: Use devm_*() routines

Lee Jones lee.jones at linaro.org
Thu Nov 22 21:27:10 EST 2012


On Thu, 22 Nov 2012, Viresh Kumar wrote:

> This patch frees stmpe driver from tension of freeing resources :)
> devm_* derivatives of multiple routines are used while allocating resources,
> which would be freed automatically by kernel.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar at linaro.org>
> ---
> 
> V1->V2:
> ------
> - Rebased over latest for-next from Samuel
> - updated additional kzalloc with devm_kzalloc(), first one seen below.
> 
>  drivers/mfd/stmpe.c | 60 +++++++++++++++++++----------------------------------
>  1 file changed, 21 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index ba157d4..c0df4b9 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -1052,17 +1052,17 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
>  	int ret;
>  
>  	if (!pdata) {
> -		if (np) {
> -			pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
> -			if (!pdata)
> -				return -ENOMEM;
> -
> -			stmpe_of_probe(pdata, np);
> -		} else
> +		if (!np)

I'm assuming you've reversed the semantics here for >80 chars reasons?

I see no harm in it though.

Acked-by: Lee Jones <lee.jones at linaro.org>

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


More information about the devicetree-discuss mailing list