Skip to contentSkip to conversation

mtd: orion_nand: convert printk to dev_*

PATCH In review Andy Shevchenko 3 participants 5 messages Jun 9, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: orion_nand: convert printk to dev_*

It's better to use actual device name as a prefix in error messages.

---
 drivers/mtd/nand/orion_nand.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mtd/nand/orion_nand.c +4 -3
index 8fbd002..ba38853 100644
@@ -87,7 +87,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 
 	nc = kzalloc(sizeof(struct nand_chip) + sizeof(struct mtd_info), GFP_KERNEL);
 	if (!nc) {
-		printk(KERN_ERR "orion_nand: failed to allocate device structure.\n");
+		dev_err(&pdev->dev, "failed to allocate device structure.\n");
 		ret = -ENOMEM;
 		goto no_res;
 	}
@@ -101,7 +101,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 
 	io_base = ioremap(res->start, resource_size(res));
 	if (!io_base) {
-		printk(KERN_ERR "orion_nand: ioremap failed\n");
+		dev_err(&pdev->dev, "ioremap failed\n");
 		ret = -EIO;
 		goto no_res;
 	}
@@ -110,7 +110,8 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data),
 					GFP_KERNEL);
 		if (!board) {
-			printk(KERN_ERR "orion_nand: failed to allocate board structure.\n");
+			dev_err(&pdev->dev,
+				"failed to allocate board structure.\n");
 			ret = -ENOMEM;
 			goto no_res;
 		}
Signature · 1 line
1.8.3.101.g727a46b
#1 lore raw
Quoted 2 lines · Andy Shevchenko

It's better to use actual device name as a prefix in error messages.

Gar...

This doesn't apply on top of Emil's patch. Emil's patch was first so it should go in first. Also Emil's patch was a bugfix so it is more important than this printk cleanup patch.

Really, the kzalloc error messages should just be deleted. They are cargo cult error messages as in "we need an error message because we are copy and pasting from other code without thinking." Kzalloc already has far better messages built in.

Ah well...

regards,
dan carpenter

#2 lore raw
Quoted 9 lines · Dan Carpenter
Quoted 2 lines · Andy Shevchenko

It's better to use actual device name as a prefix in error messages.

Gar...

This doesn't apply on top of Emil's patch. Emil's patch was first so it should go in first. Also Emil's patch was a bugfix so it is more important than this printk cleanup patch.

Which tree has that patch incorporated? I'm okay to rebase it against that tree. Current version was done against recent linux-next.

--
With Best Regards,
Andy Shevchenko

#4 lore raw
In reply to Dan Carpenter

Hello Dan,

Thank you for pointing this out, I was going to send a second version and fix that typo anyway so I will send a patch that applies on top of Andy's patch and also remove that error message for kzalloc.

Best regards,

Emil

Quoted 19 lines · Dan Carpenter
Quoted 2 lines · Andy Shevchenko

It's better to use actual device name as a prefix in error messages.

Gar...

This doesn't apply on top of Emil's patch. Emil's patch was first so it should go in first. Also Emil's patch was a bugfix so it is more important than this printk cleanup patch.

Really, the kzalloc error messages should just be deleted. They are cargo cult error messages as in "we need an error message because we are copy and pasting from other code without thinking." Kzalloc already has far better messages built in.

Ah well...

regards,
dan carpenter

#3 lore raw
In reply to Andy Shevchenko

Hello Andy,

Thanks for the hint about converting to dev*. But I agree with Dan that error messages for kzalloc calls are a bit pointless and after removing them all the dev* calls are gone. So I will send a second version that fixes the typo and removes the error messages for kzalloc. If you have any objections let me know.

Best regards,

Emil

Quoted 17 lines · Andy Shevchenko
Quoted 9 lines · Dan Carpenter
Quoted 2 lines · Andy Shevchenko

It's better to use actual device name as a prefix in error messages.

Gar...

This doesn't apply on top of Emil's patch. Emil's patch was first so it should go in first. Also Emil's patch was a bugfix so it is more important than this printk cleanup patch.

Which tree has that patch incorporated? I'm okay to rebase it against that tree. Current version was done against recent linux-next.

--
With Best Regards,
Andy Shevchenko