All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Vaibhav Hiremath
	<vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	robert.jarzmik-GANU6spQydw@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function
Date: Fri, 10 Jul 2015 10:18:01 +0200	[thread overview]
Message-ID: <20150710081801.GD1528@katana> (raw)
In-Reply-To: <1436210695-19159-7-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

> -	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.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: wsa@the-dreams.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function
Date: Fri, 10 Jul 2015 10:18:01 +0200	[thread overview]
Message-ID: <20150710081801.GD1528@katana> (raw)
In-Reply-To: <1436210695-19159-7-git-send-email-vaibhav.hiremath@linaro.org>

> -	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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150710/b120f547/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@the-dreams.de>
To: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	robert.jarzmik@free.fr, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org
Subject: Re: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function
Date: Fri, 10 Jul 2015 10:18:01 +0200	[thread overview]
Message-ID: <20150710081801.GD1528@katana> (raw)
In-Reply-To: <1436210695-19159-7-git-send-email-vaibhav.hiremath@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

> -	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.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-07-10  8:18 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 19:24 [PATCH-v3 00/11] i2c: pxa: Fixes, cleanup and support for pxa910 family Vaibhav Hiremath
2015-07-06 19:24 ` Vaibhav Hiremath
2015-07-06 19:24 ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 01/11] i2c: pxa: keep i2c irq ON in suspend Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 02/11] i2c: pxa: No need to set slave addr for i2c master mode reset Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
     [not found]   ` <1436210695-19159-3-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:11     ` Wolfram Sang
2015-07-10  8:11       ` Wolfram Sang
2015-07-10  8:11       ` Wolfram Sang
2015-07-10 12:38       ` Vaibhav Hiremath
2015-07-10 12:38         ` Vaibhav Hiremath
2015-07-10 12:38         ` Vaibhav Hiremath
     [not found]         ` <559FBCD3.4050402-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10 14:14           ` Wolfram Sang
2015-07-10 14:14             ` Wolfram Sang
2015-07-10 14:14             ` Wolfram Sang
2015-07-10 14:25             ` Vaibhav Hiremath
2015-07-10 14:25               ` Vaibhav Hiremath
2015-07-10 14:25               ` Vaibhav Hiremath
     [not found]               ` <559FD5DB.9030308-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10 14:56                 ` Wolfram Sang
2015-07-10 14:56                   ` Wolfram Sang
2015-07-10 14:56                   ` Wolfram Sang
2015-07-13  7:09                   ` Vaibhav Hiremath
2015-07-13  7:09                     ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 04/11] i2c: pxa: Remove compile warnning in 64bit mode Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
     [not found]   ` <1436210695-19159-5-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:13     ` Wolfram Sang
2015-07-10  8:13       ` Wolfram Sang
2015-07-10  8:13       ` Wolfram Sang
2015-07-10 13:01       ` Vaibhav Hiremath
2015-07-10 13:01         ` Vaibhav Hiremath
2015-07-10 13:01         ` Vaibhav Hiremath
2015-07-10  8:25     ` Uwe Kleine-König
2015-07-10  8:25       ` Uwe Kleine-König
2015-07-10  8:25       ` Uwe Kleine-König
2015-07-06 19:24 ` [PATCH-v3 05/11] i2c: pxa: Update debug function to dump more info on error Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
     [not found]   ` <1436210695-19159-7-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:18     ` Wolfram Sang [this message]
2015-07-10  8:18       ` Wolfram Sang
2015-07-10  8:18       ` Wolfram Sang
2015-07-06 19:24 ` [PATCH-v3 07/11] i2c: pxa: enable/disable i2c module across msg xfer Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
     [not found]   ` <1436210695-19159-8-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:24     ` Wolfram Sang
2015-07-10  8:24       ` Wolfram Sang
2015-07-10  8:24       ` Wolfram Sang
2015-07-13 16:41       ` Vaibhav Hiremath
2015-07-13 16:41         ` Vaibhav Hiremath
2015-07-13 16:41         ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 08/11] Documentation: binding: add new property 'disable_after_xfer' to i2c-pxa Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
     [not found] ` <1436210695-19159-1-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-06 19:24   ` [PATCH-v3 03/11] i2c: pxa: Return I2C_RETRY when timeout in pio mode Vaibhav Hiremath
2015-07-06 19:24     ` Vaibhav Hiremath
2015-07-06 19:24     ` Vaibhav Hiremath
2015-07-06 19:24   ` [PATCH-v3 09/11] i2c: pxa: Add support for pxa910/988 & new configuration features Vaibhav Hiremath
2015-07-06 19:24     ` Vaibhav Hiremath
2015-07-06 19:24     ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 10/11] i2c: pxa: Add ILCR (tLow & tHigh) configuration support Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 11/11] Documentation: binding: add sclk adjustment properties to i2c-pxa Vaibhav Hiremath
2015-07-06 19:24   ` Vaibhav Hiremath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150710081801.GD1528@katana \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robert.jarzmik-GANU6spQydw@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.