From: Dan Carpenter Date: Tue, 18 May 2021 09:19:30 +0000 (+0300) Subject: drm/bridge: ti-sn65dsi86: fix a ternary type promotion bug X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=fcb93ec3e87fe2a58b83800edad9c23bc617672b;p=linux.git drm/bridge: ti-sn65dsi86: fix a ternary type promotion bug The ti_sn_aux_transfer() function returns ssize_t (signed long). It's supposed to return negative error codes or the number of bytes transferred. The "ret" variable is int and the "len" variable is unsigned int. The problem is that with a ternary like this, the negative int is first type promoted to unsigned int to match "len" at this point it is a high positive value. Then when it is type promoted to ssize_t (s64) it remains a high positive value instead of sign extending and becoming a negative again. Fix this by removing the ternary. Fixes: b137406d9679 ("drm/bridge: ti-sn65dsi86: If refclk, DP AUX can happen w/out pre-enable") Signed-off-by: Dan Carpenter Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/YKOGogHasIyvF8nj@mwanda --- diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index bb0a0e1c63417..45a2969afb2b3 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -1042,7 +1042,9 @@ exit: pm_runtime_mark_last_busy(pdata->dev); pm_runtime_put_autosuspend(pdata->dev); - return ret ? ret : len; + if (ret) + return ret; + return len; } static int ti_sn_bridge_parse_dsi_host(struct ti_sn65dsi86 *pdata)