Thread (24 messages) 24 messages, 3 authors, 2015-07-13

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

flat view

From: Wolfram Sang <hidden>
Date: 2015-07-10 08:18:21
Also in: linux-devicetree, linux-i2c, lkml

quoted hunk ↗ jump to hunk
-	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.
quoted hunk ↗ jump to hunk
+	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>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help