diff options
Diffstat (limited to 'drivers/i2c/i2c-core-base.c')
-rw-r--r-- | drivers/i2c/i2c-core-base.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index cb6c5cb0df0b..38af18645133 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c | |||
@@ -2258,7 +2258,8 @@ EXPORT_SYMBOL(i2c_put_adapter); | |||
2258 | /** | 2258 | /** |
2259 | * i2c_get_dma_safe_msg_buf() - get a DMA safe buffer for the given i2c_msg | 2259 | * i2c_get_dma_safe_msg_buf() - get a DMA safe buffer for the given i2c_msg |
2260 | * @msg: the message to be checked | 2260 | * @msg: the message to be checked |
2261 | * @threshold: the minimum number of bytes for which using DMA makes sense | 2261 | * @threshold: the minimum number of bytes for which using DMA makes sense. |
2262 | * Should at least be 1. | ||
2262 | * | 2263 | * |
2263 | * Return: NULL if a DMA safe buffer was not obtained. Use msg->buf with PIO. | 2264 | * Return: NULL if a DMA safe buffer was not obtained. Use msg->buf with PIO. |
2264 | * Or a valid pointer to be used with DMA. After use, release it by | 2265 | * Or a valid pointer to be used with DMA. After use, release it by |
@@ -2268,7 +2269,11 @@ EXPORT_SYMBOL(i2c_put_adapter); | |||
2268 | */ | 2269 | */ |
2269 | u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold) | 2270 | u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold) |
2270 | { | 2271 | { |
2271 | if (msg->len < threshold) | 2272 | /* also skip 0-length msgs for bogus thresholds of 0 */ |
2273 | if (!threshold) | ||
2274 | pr_debug("DMA buffer for addr=0x%02x with length 0 is bogus\n", | ||
2275 | msg->addr); | ||
2276 | if (msg->len < threshold || msg->len == 0) | ||
2272 | return NULL; | 2277 | return NULL; |
2273 | 2278 | ||
2274 | if (msg->flags & I2C_M_DMA_SAFE) | 2279 | if (msg->flags & I2C_M_DMA_SAFE) |