Commit a4a9a8cb authored by Dan Carpenter's avatar Dan Carpenter Committed by Wolfram Sang

i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
parent 480b141a
...@@ -198,10 +198,10 @@ static int slimpro_i2c_blkrd(struct slimpro_i2c_dev *ctx, u32 chip, u32 addr, ...@@ -198,10 +198,10 @@ static int slimpro_i2c_blkrd(struct slimpro_i2c_dev *ctx, u32 chip, u32 addr,
int rc; int rc;
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, readlen, DMA_FROM_DEVICE); paddr = dma_map_single(ctx->dev, ctx->dma_buffer, readlen, DMA_FROM_DEVICE);
rc = dma_mapping_error(ctx->dev, paddr); if (dma_mapping_error(ctx->dev, paddr)) {
if (rc) {
dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n", dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
ctx->dma_buffer); ctx->dma_buffer);
rc = -ENOMEM;
goto err; goto err;
} }
...@@ -241,10 +241,10 @@ static int slimpro_i2c_blkwr(struct slimpro_i2c_dev *ctx, u32 chip, ...@@ -241,10 +241,10 @@ static int slimpro_i2c_blkwr(struct slimpro_i2c_dev *ctx, u32 chip,
memcpy(ctx->dma_buffer, data, writelen); memcpy(ctx->dma_buffer, data, writelen);
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen, paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen,
DMA_TO_DEVICE); DMA_TO_DEVICE);
rc = dma_mapping_error(ctx->dev, paddr); if (dma_mapping_error(ctx->dev, paddr)) {
if (rc) {
dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n", dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
ctx->dma_buffer); ctx->dma_buffer);
rc = -ENOMEM;
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment