[PATCH 3/4] mtd: orion_nand: use dev_err() instead of printk()

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Sat Dec 21 09:22:04 EST 2013


Hi Jingoo,

Thanks for the cleanup!

I have some extra requests :-)

On Fri, Dec 20, 2013 at 05:20:50PM +0900, Jingoo Han wrote:
[..]
> diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
> index a393a5b..7cd9aed 100644
> --- a/drivers/mtd/nand/orion_nand.c
> +++ b/drivers/mtd/nand/orion_nand.c
> @@ -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, "orion_nand: failed to allocate device structure.\n");

Instead of this replacement, can you remove the error message entirely?
It's redundant for a driver to print anything after an allocation error, since an
out-of-memory condition will print quite enough information.

(Google for "Joe Perches OOM" and you'll find lots of patches removing this prints).

> @@ -110,7 +110,7 @@ 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, "orion_nand: failed to allocate board structure.\n");

Ditto.

Thanks!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com



More information about the linux-mtd mailing list