i2c: tegra: Handle potential error of tegra_i2c_flush_fifos()
authorDmitry Osipenko <digetx@gmail.com>
Tue, 29 Sep 2020 22:18:46 +0000 (01:18 +0300)
committerWolfram Sang <wsa@kernel.org>
Mon, 5 Oct 2020 20:57:39 +0000 (22:57 +0200)
Technically the tegra_i2c_flush_fifos() may fail and transfer should be
aborted in this case, but this shouldn't ever happen in practice unless
there is a bug somewhere in the driver. Let's add the error check just
for completeness.

Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-tegra.c

index 4e7d0eec0dd3752d3d1f60d03f3cac1066094603..88d6e7bb14a2acc585bfffcab2af9c8cb94e7300 100644 (file)
@@ -1177,7 +1177,9 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
        bool dma;
        u16 xfer_time = 100;
 
-       tegra_i2c_flush_fifos(i2c_dev);
+       err = tegra_i2c_flush_fifos(i2c_dev);
+       if (err)
+               return err;
 
        i2c_dev->msg_buf = msg->buf;
        i2c_dev->msg_buf_remaining = msg->len;