lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 12 Dec 2012 01:25:56 +0400
From:	Evgeniy Polyakov <zbr@...emap.net>
To:	Julia Lawall <Julia.Lawall@...6.fr>
Cc:	kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] drivers/w1/masters/mxc_w1.c: use devm_ functions

Hi

On Fri, Dec 07, 2012 at 12:15:24AM +0100, Julia Lawall (Julia.Lawall@...6.fr) wrote:
> +	mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device),
> +			    GFP_KERNEL);
>  	if (!mdev)
>  		return -ENOMEM;
>  
> -	mdev->clk = clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(mdev->clk)) {
> -		err = PTR_ERR(mdev->clk);
> -		goto failed_clk;
> -	}
> +	mdev->clk = devm_clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(mdev->clk))
> +		return PTR_ERR(mdev->clk);
>  
>  	mdev->clkdiv = (clk_get_rate(mdev->clk) / 1000000) - 1;
>  
> -	res = request_mem_region(res->start, resource_size(res),
> -				"mxc_w1");
> -	if (!res) {
> -		err = -EBUSY;
> -		goto failed_req;
> -	}
> -
> -	mdev->regs = ioremap(res->start, resource_size(res));
> -	if (!mdev->regs) {
> -		dev_err(&pdev->dev, "Cannot map mxc_w1 registers\n");
> -		goto failed_ioremap;
> -	}
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	mdev->regs = devm_request_and_ioremap(&pdev->dev, res);
> +	if (!mdev->regs)
> +		return -EBUSY;

I suppose mdev will be automatically freed, but who will release
mdev->clk and other private members of mdev structure?

-- 
	Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ