Skip to contentSkip to conversation

staging: mt29f_spinand: Replacing pr_err with dev_err after the call to devm_kzalloc

PATCH Superseded G Pooja Shamili 2 participants 2 messages Mar 6, 2016 – Mar 11, 2016

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: mt29f_spinand: Replacing pr_err with dev_err after the call to devm_kzalloc

The function devm_kzalloc has a first argument of type struct device *. This is the type of argument required by printing functions such as dev_info, dev_err, etc. Thus, functions like pr_info should not normally be used after a call to devm_kzalloc. Thus, all pr_info occurances are replaced with dev_info function calls.

This was done using Coccinelle, the patch being:
@@
expression E1,E2;
expression list args;
@@

E1 = devm_kzalloc(E2, ...);
<...
- pr_info(
+ dev_info(E2,
args);
...>

---
Changes from Version 1:
* Changed the name in the From: and Signed-off-by: to full name.

 drivers/staging/mt29f_spinand/mt29f_spinand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/mt29f_spinand/mt29f_spinand.c +2 -1
index 75fe61c..791e36f 100644
@@ -893,7 +893,8 @@ static int spinand_probe(struct spi_device *spi_nand)
 #else
 	chip->ecc.mode	= NAND_ECC_SOFT;
 	if (spinand_disable_ecc(spi_nand) < 0)
-		pr_info("%s: disable ecc failed!\n", __func__);
+		dev_info(&spi_nand->dev, "%s: disable ecc failed!\n",
+			 __func__);
 #endif
 
 	nand_set_flash_node(chip, spi_nand->dev.of_node);
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 5 lines · G Pooja Shamili

The function devm_kzalloc has a first argument of type struct device *. This is the type of argument required by printing functions such as dev_info, dev_err, etc. Thus, functions like pr_info should not normally be used after a call to devm_kzalloc. Thus, all pr_info occurances are replaced with dev_info function calls.

Your subject says "_err", not "_info" :(