Skip to content

Commit

Permalink
i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
  • Loading branch information
Dan Carpenter authored and Wolfram Sang committed Aug 24, 2015
1 parent 480b141 commit a4a9a8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/i2c/busses/i2c-xgene-slimpro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit a4a9a8c

Please sign in to comment.