Skip to contentSkip to conversation

video: tegra: Address some Smatch issues

PATCH In review Andrew Goodbody 3 participants 7 messages Oct 1, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover video: tegra: Address some Smatch issues

Smatch reported some issues with this driver including unreachable code and the use of an incorrect operator.

---
Andrew Goodbody (2):
video: tegra: Remove unreachable code
video: tegra: Incorrect operator used

 drivers/video/tegra/tegra124/dp.c  | 2 --
 drivers/video/tegra/tegra124/sor.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

---
base-commit: b2d5e46c67002e46ac339ef549ea18cf5adfcd87
change-id: 20251001-video_tegra-b0bf7f0fc136

Best regards,

Signature · 1 line
Andrew Goodbody <[email protected]>
#1 lore raw

PATCH 1/2 video: tegra: Remove unreachable code

The goto immediately after a return is unreachable. Remove it and its target label as redundant.

This issue was found by Smatch.

---
 drivers/video/tegra/tegra124/dp.c | 2 --
 1 file changed, 2 deletions(-)
drivers/video/tegra/tegra124/dp.c +0 -2
index b95b14da77d0f4d552c214e3a3f9f241f1cd4361..611bf2f81a62094922c198955d43ce1e57b61caf 100644
@@ -1515,7 +1515,6 @@ int tegra_dp_enable(struct udevice *dev, int panel_bpp,
 	if (ret || retry >= DP_POWER_ON_MAX_TRIES) {
 		debug("dp: failed to power on panel (0x%x)\n", ret);
 		return -ENETUNREACH;
-		goto error_enable;
 	}
 
 	/* Confirm DP plugging status */
@@ -1561,7 +1560,6 @@ int tegra_dp_enable(struct udevice *dev, int panel_bpp,
 	}
 
 	priv->enabled = true;
-error_enable:
 	return 0;
 }
 
Signature · 1 line
2.47.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] video: tegra: Remove unreachable code

Quoted 11 lines · Andrew Goodbody

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

The goto immediately after a return is unreachable. Remove it and its target label as redundant.

This issue was found by Smatch.

---
 drivers/video/tegra/tegra124/dp.c | 2 --
 1 file changed, 2 deletions(-)
Acked-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] video: tegra: Remove unreachable code

In reply to Andrew Goodbody

ср, 1 жовт. 2025 р. о 14:55 Andrew Goodbody <[email protected]> пише:

Quoted 10 lines

The goto immediately after a return is unreachable. Remove it and its target label as redundant.

This issue was found by Smatch.

---
 drivers/video/tegra/tegra124/dp.c | 2 --
 1 file changed, 2 deletions(-)
#4 lore raw

PATCH 2/2 video: tegra: Incorrect operator used

In reply to Andrew Goodbody

Combining two bits into a mask requires the use of the binary 'or' operator not the logical one. Correct it.

This issue was found by Smatch.

---
 drivers/video/tegra/tegra124/sor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/tegra/tegra124/sor.c +1 -1
index 1ce5330c6bcf8750c5a5adb3c92ccd8743d01b59..ccdeefbcbb1edb15a4bacfbbe770da0f88f55300 100644
@@ -336,7 +336,7 @@ static int tegra_dc_sor_io_set_dpd(struct tegra_dc_sor_data *sor, int up)
 	}
 
 	reg_val = readl(pmc_base + APBDEV_PMC_IO_DPD2_REQ);
-	reg_val &= ~(APBDEV_PMC_IO_DPD2_REQ_LVDS_ON ||
+	reg_val &= ~(APBDEV_PMC_IO_DPD2_REQ_LVDS_ON |
 			APBDEV_PMC_IO_DPD2_REQ_CODE_DEFAULT_MASK);
 
 	reg_val = up ? APBDEV_PMC_IO_DPD2_REQ_LVDS_ON |
Signature · 1 line
2.47.3
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] video: tegra: Incorrect operator used

Quoted 9 lines · Andrew Goodbody

Combining two bits into a mask requires the use of the binary 'or' operator not the logical one. Correct it.

This issue was found by Smatch.

---
 drivers/video/tegra/tegra124/sor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] video: tegra: Incorrect operator used

In reply to Andrew Goodbody

ср, 1 жовт. 2025 р. о 14:55 Andrew Goodbody <[email protected]> пише:

Quoted 10 lines

Combining two bits into a mask requires the use of the binary 'or' operator not the logical one. Correct it.

This issue was found by Smatch.

---
 drivers/video/tegra/tegra124/sor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)