Skip to content

Commit a4a9a8c

Browse files
Dan CarpenterWolfram Sang
authored andcommitted
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: 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
1 parent 480b141 commit a4a9a8c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-xgene-slimpro.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ static int slimpro_i2c_blkrd(struct slimpro_i2c_dev *ctx, u32 chip, u32 addr,
198198
int rc;
199199

200200
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, readlen, DMA_FROM_DEVICE);
201-
rc = dma_mapping_error(ctx->dev, paddr);
202-
if (rc) {
201+
if (dma_mapping_error(ctx->dev, paddr)) {
203202
dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
204203
ctx->dma_buffer);
204+
rc = -ENOMEM;
205205
goto err;
206206
}
207207

@@ -241,10 +241,10 @@ static int slimpro_i2c_blkwr(struct slimpro_i2c_dev *ctx, u32 chip,
241241
memcpy(ctx->dma_buffer, data, writelen);
242242
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen,
243243
DMA_TO_DEVICE);
244-
rc = dma_mapping_error(ctx->dev, paddr);
245-
if (rc) {
244+
if (dma_mapping_error(ctx->dev, paddr)) {
246245
dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
247246
ctx->dma_buffer);
247+
rc = -ENOMEM;
248248
goto err;
249249
}
250250

0 commit comments

Comments
 (0)