[PATCH v2 2/3] mtd: gpmi: change pr_err to dev_err

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Tue Nov 19 09:56:02 EST 2013


Hi Huang,

On Tue, Nov 19, 2013 at 10:57:51AM +0800, Huang Shijie wrote:
>  
>  	this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL);
>  	if (!this) {
> -		pr_err("Failed to allocate per-device memory\n");
> +		dev_err(&pdev->dev, "Failed to allocate per-device memory\n");
>  		return -ENOMEM;
>  	}
>  

For all the kmalloc variants you should *never* print *any* OOM messages.

If the kernel has ran out of memory to satisfy an allocation you'll get
far more descriptive errors from the mm subsystem, with a backtrace and
some more goodies ;-)

So, the patch should actually remove this entire print.

Joe Perches has been removing this messages all kernel wide:
http://archive.linuxvirtualserver.org/html/lvs-devel/2011-08/msg00001.html
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com



More information about the linux-mtd mailing list