diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2020-09-30 01:19:09 +0300 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2020-10-05 22:57:44 +0200 |
commit | 3b3b8e59d0144beb3e4c5dc29abfa1f89e6d4423 (patch) | |
tree | 931eb7d5cf39f103b084fcdc5f933d521c6abbc3 /drivers/i2c | |
parent | d380d48ff376d6e98ce0c07a70487beb5d05cb4b (diff) | |
download | linux-stable-3b3b8e59d0144beb3e4c5dc29abfa1f89e6d4423.tar.gz linux-stable-3b3b8e59d0144beb3e4c5dc29abfa1f89e6d4423.tar.bz2 linux-stable-3b3b8e59d0144beb3e4c5dc29abfa1f89e6d4423.zip |
i2c: tegra: Check errors for both positive and negative values
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.
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index d8fc5cdcc310..41b6341be7b5 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -982,7 +982,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"); @@ -1222,7 +1222,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); @@ -1248,7 +1248,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); |