On 2018-08-03 02:38 PM, Andy Shevchenko wrote:
On Fri, Aug 3, 2018 at 8:03 PM, Tony Battersby <to...@cybernetics.com> wrote:
On 08/03/2018 12:22 PM, Matthew Wilcox wrote:
On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote:
I'm pretty sure this was created in an order to avoid bad looking (and
in some cases frightening) "NULL device *" part.
JFYI: git log --no-merges --grep 'NULL device \*'
I think those commits actually argue in favour of Tony's patch to remove
the special casing.  Is it really useful to create dma pools with a NULL
device?

dma_alloc_coherent() does appear to support a NULL dev, so it might make
sense in theory.  But I can't find any in-tree callers that actually
pass a NULL dev to dma_pool_create().  So for one of the dreaded (NULL
device *) messages to show up, it would take both a new caller that
passes a NULL dev to dma_pool_create() and a bug to cause the message to
be printed.  Is that worth the special casing?

So, then you need to rephrase the commit message explaining this
("NULL device is wrong to pass in the first place... bla bla bla").


"Pre-condition(s)", you might use that term for non-obvious requirements
for a function. The assumption then is if it/they are violated that
your function won't work. It also implies your function does not check them.
One implicit pre-condition on almost all C functions that take a pointer:
that the pointer points to accessible memory.

Doug Gilbert

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to