linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/display: remove dead code in drm_edp_backlight_probe_state
@ 2025-08-20  2:30 Nai-Chen Cheng
  2025-08-20  5:18 ` Joey Pabalinas
  0 siblings, 1 reply; 2+ messages in thread
From: Nai-Chen Cheng @ 2025-08-20  2:30 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, linux-kernel-mentees, Nai-Chen Cheng

In the error path where ret < 0, the ternary operator "ret < 0 ? ret :
-EIO" will always evaluate to ret since ret is guaranteed to be
negative. Simplify by directly returning ret.

Found by Coverity(CID 1649044).

Signed-off-by: Nai-Chen Cheng <bleach1827@gmail.com>
---
 drivers/gpu/drm/display/drm_dp_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index 1ecc3df7e3167d13636e194c4aab44ee8979aa11..654d466183d5ccdefcb4029dc4efc199f3b7b6ff 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4227,7 +4227,7 @@ drm_edp_backlight_probe_state(struct drm_dp_aux *aux, struct drm_edp_backlight_i
 	if (ret < 0) {
 		drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight mode: %d\n",
 			    aux->name, ret);
-		return ret < 0 ? ret : -EIO;
+		return ret;
 	}
 
 	*current_mode = (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK);

---
base-commit: b19a97d57c15643494ac8bfaaa35e3ee472d41da
change-id: 20250820-drm-dp-helper-logically-dead-code-2-428c853deb95

Best regards,
-- 
Nai-Chen Cheng <bleach1827@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/display: remove dead code in drm_edp_backlight_probe_state
  2025-08-20  2:30 [PATCH] drm/display: remove dead code in drm_edp_backlight_probe_state Nai-Chen Cheng
@ 2025-08-20  5:18 ` Joey Pabalinas
  0 siblings, 0 replies; 2+ messages in thread
From: Joey Pabalinas @ 2025-08-20  5:18 UTC (permalink / raw)
  To: Nai-Chen Cheng
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, linux-kernel-mentees

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

On Wed, Aug 20, 2025 at 10:30:31AM +0800, Nai-Chen Cheng wrote:
> In the error path where ret < 0, the ternary operator "ret < 0 ? ret :
> -EIO" will always evaluate to ret since ret is guaranteed to be
> negative. Simplify by directly returning ret.
> 
> Found by Coverity(CID 1649044).

Acked-by: Joey Pabalinas <joeypabalinas@gmail.com>

-- 
Cheers,
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-20  5:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20  2:30 [PATCH] drm/display: remove dead code in drm_edp_backlight_probe_state Nai-Chen Cheng
2025-08-20  5:18 ` Joey Pabalinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).