* [patch] i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code
@ 2015-08-18 9:12 Dan Carpenter
2015-08-18 23:59 ` Axel Lin
2015-08-24 12:21 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-08-18 9:12 UTC (permalink / raw)
To: Wolfram Sang
Cc: Feng Kan, Hieu Le, Axel Lin, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
The dma_mapping_error() function returns true if there is an error, it
doesn't return an error code. We should return -ENOMEM.
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 1c9cb65a..4233f56 100644
--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -198,10 +198,10 @@ static int slimpro_i2c_blkrd(struct slimpro_i2c_dev *ctx, u32 chip, u32 addr,
int rc;
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, readlen, DMA_FROM_DEVICE);
- rc = dma_mapping_error(ctx->dev, paddr);
- if (rc) {
+ if (dma_mapping_error(ctx->dev, paddr)) {
dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
ctx->dma_buffer);
+ rc = -ENOMEM;
goto err;
}
@@ -241,10 +241,10 @@ static int slimpro_i2c_blkwr(struct slimpro_i2c_dev *ctx, u32 chip,
memcpy(ctx->dma_buffer, data, writelen);
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen,
DMA_TO_DEVICE);
- rc = dma_mapping_error(ctx->dev, paddr);
- if (rc) {
+ if (dma_mapping_error(ctx->dev, paddr)) {
dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
ctx->dma_buffer);
+ rc = -ENOMEM;
goto err;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code
2015-08-18 9:12 [patch] i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code Dan Carpenter
@ 2015-08-18 23:59 ` Axel Lin
2015-08-24 12:21 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Axel Lin @ 2015-08-18 23:59 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Wolfram Sang, Feng Kan, Hieu Le, linux-i2c, kernel-janitors
2015-08-18 17:12 GMT+08:00 Dan Carpenter <dan.carpenter@oracle.com>:
> The dma_mapping_error() function returns true if there is an error, it
> doesn't return an error code. We should return -ENOMEM.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code
2015-08-18 9:12 [patch] i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code Dan Carpenter
2015-08-18 23:59 ` Axel Lin
@ 2015-08-24 12:21 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2015-08-24 12:21 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Feng Kan, Hieu Le, Axel Lin, linux-i2c, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 295 bytes --]
On Tue, Aug 18, 2015 at 12:12:19PM +0300, Dan Carpenter wrote:
> The dma_mapping_error() function returns true if there is an error, it
> doesn't return an error code. We should return -ENOMEM.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to for-next, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-24 12:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-18 9:12 [patch] i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code Dan Carpenter
2015-08-18 23:59 ` Axel Lin
2015-08-24 12:21 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).