aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0054-drm-amd-display-Remove-redundant-non-zero-and-overfl.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0054-drm-amd-display-Remove-redundant-non-zero-and-overfl.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0054-drm-amd-display-Remove-redundant-non-zero-and-overfl.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0054-drm-amd-display-Remove-redundant-non-zero-and-overfl.patch b/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0054-drm-amd-display-Remove-redundant-non-zero-and-overfl.patch
new file mode 100644
index 00000000..5048f3be
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0054-drm-amd-display-Remove-redundant-non-zero-and-overfl.patch
@@ -0,0 +1,46 @@
+From a6a2b0318ce45ff7d1fac4b689f5f5080c0f54cc Mon Sep 17 00:00:00 2001
+From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
+Date: Wed, 1 Aug 2018 10:20:53 -0400
+Subject: [PATCH 0054/2940] drm/amd/display: Remove redundant non-zero and
+ overflow check
+
+[Why]
+Unsigned int is guaranteed to be >= 0, and read_channel_reply checks for
+overflows. read_channel_reply also returns -1 on error, which is what
+dc_link_aux_transfer is expected to return on error.
+
+[How]
+Remove the if-statement. Return result of read_channel_reply directly.
+
+Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
+Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>
+Acked-by: Leo Li <sunpeng.li@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+index 8def0d9fa0ff..506a97e16956 100644
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+@@ -666,13 +666,9 @@ int dc_link_aux_transfer(struct ddc_service *ddc,
+
+ switch (operation_result) {
+ case AUX_CHANNEL_OPERATION_SUCCEEDED:
+- res = returned_bytes;
+-
+- if (res <= size && res >= 0)
+- res = aux_engine->funcs->read_channel_reply(aux_engine, size,
+- buffer, reply,
+- &status);
+-
++ res = aux_engine->funcs->read_channel_reply(aux_engine, size,
++ buffer, reply,
++ &status);
+ break;
+ case AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON:
+ res = 0;
+--
+2.17.1
+