Commit 6ac69290 authored by Philippe Cornu's avatar Philippe Cornu Committed by Sean Paul

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: default avatarPhilippe Cornu <philippe.cornu@st.com>
Reviewed-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180112144847.18810-1-philippe.cornu@st.com
parent fd2cb71b
...@@ -498,8 +498,9 @@ int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi) ...@@ -498,8 +498,9 @@ int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi)
.tx_buf = (u8 [2]) { 0, 0 }, .tx_buf = (u8 [2]) { 0, 0 },
.tx_len = 2, .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); EXPORT_SYMBOL(mipi_dsi_shutdown_peripheral);
...@@ -517,8 +518,9 @@ int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi) ...@@ -517,8 +518,9 @@ int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi)
.tx_buf = (u8 [2]) { 0, 0 }, .tx_buf = (u8 [2]) { 0, 0 },
.tx_len = 2, .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); EXPORT_SYMBOL(mipi_dsi_turn_on_peripheral);
...@@ -541,8 +543,9 @@ int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, ...@@ -541,8 +543,9 @@ int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
.tx_len = sizeof(tx), .tx_len = sizeof(tx),
.tx_buf = 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); EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment