Re: [PATCH 2.6.20-rc1] ib_verbs: Use explicit if-else statements to avoid errors with do-while macros

From: Roland Dreier
Date: Thu Dec 14 2006 - 01:26:44 EST


I see Linus already took this, which is fine... blame me for merging
this without fixing my cross-compile testbed.

Anyway:

> static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr)
> {
> - return dev->dma_ops ?
> - dev->dma_ops->mapping_error(dev, dma_addr) :
> - dma_mapping_error(dma_addr);
> + if (dev->dma_ops)
> + return dev->dma_ops->mapping_error(dev, dma_addr);
> + return dma_mapping_error(dma_addr);

This stuff wasn't needed, was it? It's only the wrappers around void
functions that can't use ?: I would think... surely any trivial macro
replacement for a dma API function that returns a value must evaluate
to something like (0) that is safe to use in this context.

- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/