diff mbox series

i2c: imx: fix inconsistent IS_ERR and PTR_ERR

Message ID 20190123003741.GA12068@embeddedor (mailing list archive)
State Mainlined, archived
Commit 3d5b38684951564d07e3f4bb482ef9491f49ced1
Headers show
Series i2c: imx: fix inconsistent IS_ERR and PTR_ERR | expand

Commit Message

Gustavo A. R. Silva Jan. 23, 2019, 12:37 a.m. UTC
Fix inconsistent IS_ERR and PTR_ERR in i2c_imx_dma_request.

The proper pointer to be passed as argument is dma->chan_tx.

This bug was detected with the help of Coccinelle.

Fixes: 5b3a23a3cc94 ("i2c: imx: notify about real errors on dma i2c_imx_dma_request")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/i2c/busses/i2c-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang Jan. 23, 2019, 8:28 a.m. UTC | #1
On Tue, Jan 22, 2019 at 06:37:41PM -0600, Gustavo A. R. Silva wrote:
> Fix inconsistent IS_ERR and PTR_ERR in i2c_imx_dma_request.
> 
> The proper pointer to be passed as argument is dma->chan_tx.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: 5b3a23a3cc94 ("i2c: imx: notify about real errors on dma i2c_imx_dma_request")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

I pushed a similar fix to linux-next yesterday.
Gustavo A. R. Silva Jan. 23, 2019, 8:55 a.m. UTC | #2
On 1/23/19 2:28 AM, Wolfram Sang wrote:
> On Tue, Jan 22, 2019 at 06:37:41PM -0600, Gustavo A. R. Silva wrote:
>> Fix inconsistent IS_ERR and PTR_ERR in i2c_imx_dma_request.
>>
>> The proper pointer to be passed as argument is dma->chan_tx.
>>
>> This bug was detected with the help of Coccinelle.
>>
>> Fixes: 5b3a23a3cc94 ("i2c: imx: notify about real errors on dma i2c_imx_dma_request")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> I pushed a similar fix to linux-next yesterday.
> 

Great. Good to know it is fixed now. :)

Thanks
--
Gustavo
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 09b124547669..42fed40198a0 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -287,7 +287,7 @@  static int i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx,
 
 	dma->chan_tx = dma_request_chan(dev, "tx");
 	if (IS_ERR(dma->chan_tx)) {
-		ret = PTR_ERR(dma->chan_rx);
+		ret = PTR_ERR(dma->chan_tx);
 		if (ret != -ENODEV && ret != -EPROBE_DEFER)
 			dev_err(dev, "can't request DMA tx channel (%d)\n", ret);
 		goto fail_al;