Re: [PATCH] Parisc: Check kmalloc return value before use the buffer in ccio-dma.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kyle McMartin
Date: Wednesday, May 5, 2010 - 9:03 pm

On Thu, May 06, 2010 at 10:42:08AM +0800, wzt.wzt@gmail.com wrote:

This code can't fail, since the failure case won't be handled by the
probe function, and will continue along without properly initializing
the resources and will fail later. While we could add proper error
handling, if these functions are called, the ccio IOMMU exists on the
machine, and without it, we can't do any DMA (amongst other things.)
So in that case, if this kmalloc fails (which it really shouldn't...)
we're pretty much screwed.

We can change it to GFP_ATOMIC|__GFP_NOFAIL so it will retry infinitely,
or we can panic in the error path with a nice error message so the users
knows why his machine isn't going to work.

I suggest the latter since you'll have the test to squelch gcc warnings
and such.

regards, Kyle

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Parisc: Check kmalloc return value before use ..., Kyle McMartin, (Wed May 5, 9:03 pm)