Hi On Fri, Dec 07, 2012 at 12:15:24AM +0100, Julia Lawall (Julia.Lawall@xxxxxxx) 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 kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html