[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180112144847.18810-1-philippe.cornu@st.com>
Date: Fri, 12 Jan 2018 15:48:47 +0100
From: Philippe Cornu <philippe.cornu@...com>
To: Daniel Vetter <daniel.vetter@...el.com>,
Gustavo Padovan <gustavo@...ovan.org>,
Sean Paul <seanpaul@...omium.org>,
David Airlie <airlied@...ux.ie>,
Andrzej Hajda <a.hajda@...sung.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
CC: Archit Taneja <architt@...eaurora.org>,
Brian Norris <briannorris@...omium.org>,
Benjamin Gaignard <benjamin.gaignard@...aro.org>,
Yannick Fertre <yannick.fertre@...com>,
Vincent Abriou <vincent.abriou@...com>,
Alexandre Torgue <alexandre.torgue@...com>
Subject: [PATCH] drm/dsi: Fix improper use of mipi_dsi_device_transfer() return value
The function mipi_dsi_device_transfer() returns the number of transmitted
or received bytes on success or a negative error code on failure.
The functions mipi_dsi_shutdown_peripheral(), mipi_dsi_turn_on_peripheral() &
mipi_dsi_set_maximum_return_packet_size() use improperly this returned
value in case of success: 0 should be returned instead of the number of
transmitted bytes.
Signed-off-by: Philippe Cornu <philippe.cornu@...com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 4b47226b90d4..bc73b7f5b9fc 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -498,8 +498,9 @@ int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi)
.tx_buf = (u8 [2]) { 0, 0 },
.tx_len = 2,
};
+ int ret = mipi_dsi_device_transfer(dsi, &msg);
- return mipi_dsi_device_transfer(dsi, &msg);
+ return (ret < 0) ? ret : 0;
}
EXPORT_SYMBOL(mipi_dsi_shutdown_peripheral);
@@ -517,8 +518,9 @@ int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi)
.tx_buf = (u8 [2]) { 0, 0 },
.tx_len = 2,
};
+ int ret = mipi_dsi_device_transfer(dsi, &msg);
- return mipi_dsi_device_transfer(dsi, &msg);
+ return (ret < 0) ? ret : 0;
}
EXPORT_SYMBOL(mipi_dsi_turn_on_peripheral);
@@ -541,8 +543,9 @@ int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
.tx_len = sizeof(tx),
.tx_buf = tx,
};
+ int ret = mipi_dsi_device_transfer(dsi, &msg);
- return mipi_dsi_device_transfer(dsi, &msg);
+ return (ret < 0) ? ret : 0;
}
EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);
--
2.15.1
Powered by blists - more mailing lists