Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1181358

Re: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function

From Wolfram Sang <wsa@the-dreams.de>
Newsgroups linux.kernel
Subject Re: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function
Date 2015-07-10 10:20 +0200
Message-ID <pKBHl-3ui-33@gated-at.bofh.it> (permalink)
References <pJkfw-3Ye-3@gated-at.bofh.it> <pJkfw-3Ye-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

> -	i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
> +	i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL);
>  	if (!i2c) {
> -		ret = -ENOMEM;
> -		goto emalloc;
> +		dev_err(&dev->dev, "memory allocation failed\n");

No message here, we get a dump anyhow.

> +	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&dev->dev, "no mem resource\n");
> +		return -ENODEV;
> +	}

You can skip this check, devm_ioremap_resource will do it.

> +		dev_err(&dev->dev, "failed to get the clk: %ld\n",
> +			PTR_ERR(i2c->clk));

Sidenote for all patches: I am not so strict with the 80 char limit. I'd
think the above code would be more readable if it was one line. But you
decide.

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function Wolfram Sang <wsa@the-dreams.de> - 2015-07-10 10:20 +0200

csiph-web