lkml.org 
[lkml]   [2020]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 25/31] i2c: tegra: Check errors for both positive and negative values
Date
The driver's code is inconsistent in regards to the error values checking.
The correct way should be to check both positive and negative values.
This patch cleans up the error-checks in the code. Note that the
pm_runtime_get_sync() could return positive value on success, hence only
relevant parts of the code are changed by this patch.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
drivers/i2c/busses/i2c-tegra.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 9b4107b07135..64776cd8e0ff 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -969,7 +969,7 @@ static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev,

slv_config.device_fc = true;
ret = dmaengine_slave_config(chan, &slv_config);
- if (ret < 0) {
+ if (ret) {
dev_err(i2c_dev->dev, "DMA slave config failed: %d\n",
ret);
dev_err(i2c_dev->dev, "falling back to PIO\n");
@@ -1208,7 +1208,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
xfer_size,
DMA_FROM_DEVICE);
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
- if (err < 0) {
+ if (err) {
dev_err(i2c_dev->dev,
"starting RX DMA failed, err %d\n",
err);
@@ -1233,7 +1233,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
xfer_size,
DMA_TO_DEVICE);
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
- if (err < 0) {
+ if (err) {
dev_err(i2c_dev->dev,
"starting TX DMA failed, err %d\n",
err);
--
2.27.0
\
 
 \ /
  Last update: 2020-09-05 23:10    [W:0.355 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site