[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220811152851.1520029-46-sashal@kernel.org>
Date: Thu, 11 Aug 2022 11:27:30 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: KuoHsiang Chou <kuohsiang_chou@...eedtech.com>,
kernel test robot <lkp@...el.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Sasha Levin <sashal@...nel.org>, airlied@...hat.com,
airlied@...ux.ie, daniel@...ll.ch, dri-devel@...ts.freedesktop.org
Subject: [PATCH AUTOSEL 5.19 046/105] drm/ast: Fixed the casting issue reported by sparse
From: KuoHsiang Chou <kuohsiang_chou@...eedtech.com>
[ Upstream commit 232b95ba4e83ca0a77f19fc772ccc6581051e5cc ]
V1:
1.Fixed sparse:cast truncates bits form constant value ()cast
truncates bits from constant value (ffffffffffffff00 becomes 0)
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: KuoHsiang Chou <kuohsiang_chou@...eedtech.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@...e.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220623083116.35365-1-kuohsiang_chou@aspeedtech.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/gpu/drm/ast/ast_dp.c | 10 +++++-----
drivers/gpu/drm/ast/ast_drv.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_dp.c b/drivers/gpu/drm/ast/ast_dp.c
index f573d582407e..56483860306b 100644
--- a/drivers/gpu/drm/ast/ast_dp.c
+++ b/drivers/gpu/drm/ast/ast_dp.c
@@ -34,7 +34,7 @@ int ast_astdp_read_edid(struct drm_device *dev, u8 *ediddata)
* CRE4[7:0]: Read-Pointer for EDID (Unit: 4bytes); valid range: 0~64
*/
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE4,
- (u8) ~ASTDP_EDID_READ_POINTER_MASK, (u8) i);
+ ASTDP_AND_CLEAR_MASK, (u8)i);
j = 0;
/*
@@ -274,8 +274,8 @@ void ast_dp_set_mode(struct drm_crtc *crtc, struct ast_vbios_mode_info *vbios_mo
* CRE1[7:0]: MISC1 (default: 0x00)
* CRE2[7:0]: video format index (0x00 ~ 0x20 or 0x40 ~ 0x50)
*/
- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE0, (u8) ~ASTDP_CLEAR_MASK,
- ASTDP_MISC0_24bpp);
- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE1, (u8) ~ASTDP_CLEAR_MASK, ASTDP_MISC1);
- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE2, (u8) ~ASTDP_CLEAR_MASK, ModeIdx);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE0, ASTDP_AND_CLEAR_MASK,
+ ASTDP_MISC0_24bpp);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE1, ASTDP_AND_CLEAR_MASK, ASTDP_MISC1);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE2, ASTDP_AND_CLEAR_MASK, ModeIdx);
}
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index a34db4380f68..2e44b971c3a6 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -433,7 +433,7 @@ int ast_mode_config_init(struct ast_private *ast);
*/
#define ASTDP_MISC0_24bpp BIT(5)
#define ASTDP_MISC1 0
-#define ASTDP_CLEAR_MASK GENMASK(7, 0)
+#define ASTDP_AND_CLEAR_MASK 0x00
/*
* ASTDP resoultion table:
--
2.35.1
Powered by blists - more mailing lists