[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202205312143.Fbn8z9qP-lkp@intel.com>
Date: Tue, 31 May 2022 21:13:56 +0800
From: kernel test robot <lkp@...el.com>
To: KuoHsiang Chou <kuohsiang_chou@...eedtech.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Thomas Zimmermann <tzimmermann@...e.de>
Subject: drivers/gpu/drm/ast/ast_dp.c:37:46: sparse: sparse: cast truncates
bits from constant value (ffffff00 becomes 0)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ab2afa23bd197df47819a87f0265c0ac95c5b6a
commit: 594e9c04b5864b4b8b151ef4ba9521c59e0f5c54 drm/ast: Create the driver for ASPEED proprietory Display-Port
date: 4 weeks ago
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220531/202205312143.Fbn8z9qP-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-14-g5a0004b5-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=594e9c04b5864b4b8b151ef4ba9521c59e0f5c54
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 594e9c04b5864b4b8b151ef4ba9521c59e0f5c54
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/ast/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/ast/ast_dp.c:37:46: sparse: sparse: cast truncates bits from constant value (ffffff00 becomes 0)
drivers/gpu/drm/ast/ast_dp.c:278:66: sparse: sparse: cast truncates bits from constant value (ffffff00 becomes 0)
drivers/gpu/drm/ast/ast_dp.c:280:66: sparse: sparse: cast truncates bits from constant value (ffffff00 becomes 0)
drivers/gpu/drm/ast/ast_dp.c:281:66: sparse: sparse: cast truncates bits from constant value (ffffff00 becomes 0)
vim +37 drivers/gpu/drm/ast/ast_dp.c
9
10 int ast_astdp_read_edid(struct drm_device *dev, u8 *ediddata)
11 {
12 struct ast_private *ast = to_ast_private(dev);
13 u8 i = 0, j = 0;
14
15 /*
16 * CRD1[b5]: DP MCU FW is executing
17 * CRDC[b0]: DP link success
18 * CRDF[b0]: DP HPD
19 * CRE5[b0]: Host reading EDID process is done
20 */
21 if (!(ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD1, ASTDP_MCU_FW_EXECUTING) &&
22 ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDC, ASTDP_LINK_SUCCESS) &&
23 ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDF, ASTDP_HPD) &&
24 ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE5,
25 ASTDP_HOST_EDID_READ_DONE_MASK))) {
26 goto err_astdp_edid_not_ready;
27 }
28
29 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE5, (u8) ~ASTDP_HOST_EDID_READ_DONE_MASK,
30 0x00);
31
32 for (i = 0; i < 32; i++) {
33 /*
34 * CRE4[7:0]: Read-Pointer for EDID (Unit: 4bytes); valid range: 0~64
35 */
36 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE4,
> 37 (u8) ~ASTDP_EDID_READ_POINTER_MASK, (u8) i);
38 j = 0;
39
40 /*
41 * CRD7[b0]: valid flag for EDID
42 * CRD6[b0]: mirror read pointer for EDID
43 */
44 while ((ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD7,
45 ASTDP_EDID_VALID_FLAG_MASK) != 0x01) ||
46 (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD6,
47 ASTDP_EDID_READ_POINTER_MASK) != i)) {
48 /*
49 * Delay are getting longer with each retry.
50 * 1. The Delays are often 2 loops when users request "Display Settings"
51 * of right-click of mouse.
52 * 2. The Delays are often longer a lot when system resume from S3/S4.
53 */
54 mdelay(j+1);
55
56 if (!(ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD1,
57 ASTDP_MCU_FW_EXECUTING) &&
58 ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDC,
59 ASTDP_LINK_SUCCESS) &&
60 ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDF, ASTDP_HPD))) {
61 goto err_astdp_jump_out_loop_of_edid;
62 }
63
64 j++;
65 if (j > 200)
66 goto err_astdp_jump_out_loop_of_edid;
67 }
68
69 *(ediddata) = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT,
70 0xD8, ASTDP_EDID_READ_DATA_MASK);
71 *(ediddata + 1) = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD9,
72 ASTDP_EDID_READ_DATA_MASK);
73 *(ediddata + 2) = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDA,
74 ASTDP_EDID_READ_DATA_MASK);
75 *(ediddata + 3) = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDB,
76 ASTDP_EDID_READ_DATA_MASK);
77
78 if (i == 31) {
79 /*
80 * For 128-bytes EDID_1.3,
81 * 1. Add the value of Bytes-126 to Bytes-127.
82 * The Bytes-127 is Checksum. Sum of all 128bytes should
83 * equal 0 (mod 256).
84 * 2. Modify Bytes-126 to be 0.
85 * The Bytes-126 indicates the Number of extensions to
86 * follow. 0 represents noextensions.
87 */
88 *(ediddata + 3) = *(ediddata + 3) + *(ediddata + 2);
89 *(ediddata + 2) = 0;
90 }
91
92 ediddata += 4;
93 }
94
95 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE5, (u8) ~ASTDP_HOST_EDID_READ_DONE_MASK,
96 ASTDP_HOST_EDID_READ_DONE);
97
98 return 0;
99
100 err_astdp_jump_out_loop_of_edid:
101 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE5,
102 (u8) ~ASTDP_HOST_EDID_READ_DONE_MASK,
103 ASTDP_HOST_EDID_READ_DONE);
104 return (~(j+256) + 1);
105
106 err_astdp_edid_not_ready:
107 if (!(ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xD1, ASTDP_MCU_FW_EXECUTING)))
108 return (~0xD1 + 1);
109 if (!(ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDC, ASTDP_LINK_SUCCESS)))
110 return (~0xDC + 1);
111 if (!(ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xDF, ASTDP_HPD)))
112 return (~0xDF + 1);
113 if (!(ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE5, ASTDP_HOST_EDID_READ_DONE_MASK)))
114 return (~0xE5 + 1);
115
116 return 0;
117 }
118
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists