Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754028AbbGJISV (ORCPT ); Fri, 10 Jul 2015 04:18:21 -0400 Received: from sauhun.de ([89.238.76.85]:52540 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752887AbbGJISE (ORCPT ); Fri, 10 Jul 2015 04:18:04 -0400 Date: Fri, 10 Jul 2015 10:18:01 +0200 From: Wolfram Sang To: Vaibhav Hiremath 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 Message-ID: <20150710081801.GD1528@katana> References: <1436210695-19159-1-git-send-email-vaibhav.hiremath@linaro.org> <1436210695-19159-7-git-send-email-vaibhav.hiremath@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8nsIa27JVQLqB7/C" Content-Disposition: inline In-Reply-To: <1436210695-19159-7-git-send-email-vaibhav.hiremath@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2021 Lines: 58 --8nsIa27JVQLqB7/C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > - 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. --8nsIa27JVQLqB7/C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVn3+4AAoJEBQN5MwUoCm2tQ8P/07DUHwKmvZx1aHS/8po+ORV fHhTbqIfupQj2N3LZvq8HyPs2hODWT1RpTT1ZaX/0+UntNzaGoJPfdDXVlpLU+43 8IFGJJpWTBj1DfPJdOUAeHoehQis9vK3D6Df6Ld2tylElT0dy+/sdiIdPYRtld3s sZji8bKu8C1XqM8yMeLJLnANlGnS7Cf+GXDzy7JR+H5XO579C5z8FQJoI6zk/rsi sgjvwmtk2G9agdGvv3OzkGGdJGEBLcXowIbHe281CQCpkNqqVaOREz3bJLh11780 iZ9mRqXW4L8URC5Aiy+1J2oSO3uUxnLRbd1N559Ep8wP8xuX2ZR3ewiEvjA7qY5x M9TGIUXSspggtZZCcsdpX7qLAHVT4vJOh4bshzDd4gTRz15g3ZVDwUWKvabnZE+m UUJ8vmILQMTsVOynd6Upgs5GUYQXXhXb/vUOoUA/VnsTreAo5PKgRM+kB3nx0iTm edGf0mKKFYZMMl1WkdD1wjSQc8zdAWCHN+d3VeR4HCgdEDEa1/HM3mYwZxkMuQS3 1QhtXU4F7OSxVv3qEYPzpb0FDWBDI/Qy4o9gJUYpVUnQxrRUnzXl1pncLTduztGj 0/ko9XkffwGTv4E70ytj2m3yMG9+k1EfWukpmmuyPlPuMT5z7vpIjgmZ731L/V8D YPkKBa4gLC+Tu7qnweWM =61G0 -----END PGP SIGNATURE----- --8nsIa27JVQLqB7/C-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/