video: tegra: Address some Smatch issues
Subsystems (2)
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]>
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
@@ -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
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.
Signed-off-by Andrew Goodbody <[email protected]>--- drivers/video/tegra/tegra124/dp.c | 2 -- 1 file changed, 2 deletions(-)
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.
Signed-off-by Andrew Goodbody <[email protected]>--- drivers/video/tegra/tegra124/dp.c | 2 -- 1 file changed, 2 deletions(-)
PATCH 2/2 video: tegra: Incorrect operator used
In reply to Andrew GoodbodyCombining 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
@@ -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
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.
Signed-off-by Andrew Goodbody <[email protected]>--- drivers/video/tegra/tegra124/sor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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.
Signed-off-by Andrew Goodbody <[email protected]>--- drivers/video/tegra/tegra124/sor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)