From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/gpu/drm/bridge/ite-it6505.c:1330:5: warning: Variable 'audio_word_length_map' can be declared with const [constVariable]
Date: Sat, 20 Aug 2022 15:41:33 +0800 [thread overview]
Message-ID: <202208201508.pilo8lWn-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 13288 bytes --]
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/gpu/drm/bridge/ite-it6505.c:1330:5: warning: Variable 'audio_word_length_map' can be declared with const [constVariable]"
::::::
BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Allen Chen <allen.chen@ite.com.tw>
CC: Robert Foss <robert.foss@linaro.org>
CC: Hermes Wu <hermes.wu@ite.com.tw>
CC: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 50cd95ac46548429e5bba7ca75cc97d11a697947
commit: b5c84a9edcd418cd055becad6a22439e7c5e3bf8 drm/bridge: add it6505 driver
date: 7 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 7 months ago
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout b5c84a9edcd418cd055becad6a22439e7c5e3bf8
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/video/fbdev/carminefb.c:404:10: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
mode |= CARMINE_DEN | CARMINE_L0E;
^
>> drivers/video/fbdev/carminefb.c:404:10: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
mode |= CARMINE_DEN | CARMINE_L0E;
^
--
>> drivers/video/fbdev/gxt4500.c:257:24: warning: Either the condition 't>=0' is redundant or there is division by zero at line 257. [zerodivcond]
n = intf * postdiv / period_ps;
^
drivers/video/fbdev/gxt4500.c:262:11: note: Assuming that condition 't>=0' is not redundant
if (t >= 0 && t < best_error) {
^
drivers/video/fbdev/gxt4500.c:261:10: note: Assignment to 't-=period_ps'
t -= period_ps;
^
drivers/video/fbdev/gxt4500.c:257:24: note: Division by zero
n = intf * postdiv / period_ps;
^
--
>> drivers/video/fbdev/cyber2000fb.c:339:24: warning: Either the condition 'regno<64' is redundant or the array 'cfb->palette[256]' is accessed at index 504, which is out of bounds. [arrayIndexOutOfBoundsCond]
green = cfb->palette[regno << 3].green;
^
drivers/video/fbdev/cyber2000fb.c:325:39: note: Assuming that condition 'regno<64' is not redundant
if (var->green.length == 6 && regno < 64) {
^
drivers/video/fbdev/cyber2000fb.c:339:24: note: Array index out of bounds
green = cfb->palette[regno << 3].green;
^
>> drivers/gpu/drm/bridge/tc358764.c:247:31: warning: Signed integer overflow for expression '((1<<(31-20+1))-1)<<20'. [integerOverflow]
tc358764_write(ctx, VP_CTRL, VP_CTRL_VSDELAY(15) | VP_CTRL_RGB888(1) |
^
--
>> drivers/video/fbdev/aty/aty128fb.c:2273:13: warning: Either the condition 'regno>0' is redundant or the array 'par->green[64]' is accessed at index 64, which is out of bounds. [arrayIndexOutOfBoundsCond]
par->green[regno] = green;
^
drivers/video/fbdev/aty/aty128fb.c:2265:37: note: Assuming that condition 'regno>0' is not redundant
if (par->crtc.depth == 16 && regno > 0) {
^
drivers/video/fbdev/aty/aty128fb.c:2273:13: note: Array index out of bounds
par->green[regno] = green;
^
>> drivers/video/fbdev/aty/aty128fb.c:1041:5: warning: Variable 'mode_bytpp' can be declared with const [constVariable]
u8 mode_bytpp[7] = { 0, 0, 1, 2, 2, 3, 4 };
^
drivers/video/fbdev/aty/aty128fb.c:1324:16: warning: Variable 'post_conv' can be declared with const [constVariable]
unsigned char post_conv[] = /* register values for post dividers */
^
>> drivers/video/fbdev/aty/aty128fb.c:657:37: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
if (!(aty_ld_le32(GUI_STAT) & (1 << 31))) {
^
>> drivers/video/fbdev/aty/aty128fb.c:657:37: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
if (!(aty_ld_le32(GUI_STAT) & (1 << 31))) {
^
drivers/video/fbdev/aty/aty128fb.c:955:11: warning: Variable 'PostDivSet' can be declared with const [constVariable]
unsigned PostDivSet[] = { 0, 1, 2, 4, 8, 3, 6, 12 };
^
>> drivers/gpu/drm/panel/panel-truly-nt35597.c:237:9: warning: Uninitialized variable: ret [uninitvar]
return ret;
^
drivers/gpu/drm/panel/panel-truly-nt35597.c:230:16: note: Assuming condition is false
for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) {
^
drivers/gpu/drm/panel/panel-truly-nt35597.c:237:9: note: Uninitialized variable: ret
return ret;
^
--
>> drivers/video/fbdev/aty/atyfb_base.c:3977:11: warning: Same expression on both sides of '&&' because 'err1' and 'err2' represent the same value. [knownConditionTrueFalse]
if (err1 && err2)
^
drivers/video/fbdev/aty/atyfb_base.c:3961:13: note: 'err1' is assigned value '1' here.
int err1 = 1, err2 = 1;
^
drivers/video/fbdev/aty/atyfb_base.c:3961:23: note: 'err2' is assigned value '1' here.
int err1 = 1, err2 = 1;
^
drivers/video/fbdev/aty/atyfb_base.c:3977:11: note: Same expression on both sides of '&&' because 'err1' and 'err2' represent the same value.
if (err1 && err2)
^
>> drivers/video/fbdev/aty/atyfb_base.c:2367:5: warning: Unused variable: dac_type [unusedVariable]
u8 dac_type;
^
drivers/video/fbdev/aty/atyfb_base.c:3578:5: warning: Redundant initialization for 'rc'. The initialized value is overwritten before it is read. [redundantInitialization]
rc = atyfb_setup_generic(pdev, info, addr);
^
drivers/video/fbdev/aty/atyfb_base.c:3537:9: note: rc is initialized
int rc = -ENOMEM;
^
drivers/video/fbdev/aty/atyfb_base.c:3578:5: note: rc is overwritten
rc = atyfb_setup_generic(pdev, info, addr);
^
>> drivers/gpu/drm/drm_mipi_dsi.c:307:73: warning: Parameter 'node' can be declared with const [constParameter]
struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
^
--
>> drivers/gpu/drm/qxl/qxl_object.c:111:25: warning: Parameter 'surf' can be declared with const [constParameter]
struct qxl_surface *surf,
^
>> drivers/gpu/drm/ttm/ttm_bo.c:1134:28: warning: Local variable 'ctx' shadows outer argument [shadowArgument]
struct ttm_operation_ctx ctx = { false, false };
^
drivers/gpu/drm/ttm/ttm_bo.c:1093:76: note: Shadowed declaration
int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
^
drivers/gpu/drm/ttm/ttm_bo.c:1134:28: note: Shadow variable
struct ttm_operation_ctx ctx = { false, false };
^
--
>> drivers/video/fbdev/aty/radeon_base.c:1645:5: warning: Variable 'hsync_fudge_fp' can be declared with const [constVariable]
u8 hsync_fudge_fp[] = {2, 2, 0, 0, 5, 5};
^
>> drivers/video/fbdev/aty/radeon_base.c:1644:5: warning: Variable 'hsync_adj_tab' can be declared with const [constVariable]
u8 hsync_adj_tab[] = {0, 0x12, 9, 9, 6, 5};
^
>> drivers/gpu/drm/bridge/tc358767.c:846:18: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
dp0_syncval |= SYNCVAL_VS_POL_ACTIVE_LOW;
^
>> drivers/gpu/drm/bridge/tc358767.c:846:18: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
dp0_syncval |= SYNCVAL_VS_POL_ACTIVE_LOW;
^
drivers/gpu/drm/bridge/tc358767.c:1026:11: warning: Signed integer overflow for expression '15<<28'. [integerOverflow]
(15 << 28) | /* Defer Iteration Count */
^
--
>> drivers/gpu/drm/bridge/ite-it6505.c:1330:5: warning: Variable 'audio_word_length_map' can be declared with const [constVariable]
u8 audio_word_length_map[] = { 0x02, 0x04, 0x03, 0x0B };
^
>> drivers/gpu/drm/bridge/ite-it6505.c:1620:56: warning: Parameter 'lane_voltage_swing' can be declared with const [constParameter]
static bool it6505_check_max_voltage_swing_reached(u8 *lane_voltage_swing,
^
--
In file included from drivers/gpu/drm/radeon/radeon_object.c:
>> drivers/gpu/drm/radeon/radeon_object.c:503:8: warning: Uninitialized variable: bo [uninitvar]
if (!bo->tbo.pin_count) {
^
drivers/gpu/drm/radeon/radeon_object.c:497:14: note: Assuming condition is false
if (unlikely(r != 0)) {
^
drivers/gpu/drm/radeon/radeon_object.c:502:30: note: Assignment 'bo=lobj->robj', assigned value is <Uninit>
struct radeon_bo *bo = lobj->robj;
^
drivers/gpu/drm/radeon/radeon_object.c:503:8: note: Uninitialized variable: bo
if (!bo->tbo.pin_count) {
^
>> drivers/gpu/drm/radeon/radeon_object.c:517:9: warning: Uninitialized variable: allowed [uninitvar]
if ((allowed & current_domain) != 0 &&
^
drivers/gpu/drm/radeon/radeon_object.c:497:14: note: Assuming condition is false
if (unlikely(r != 0)) {
^
drivers/gpu/drm/radeon/radeon_object.c:505:22: note: Assignment 'allowed=lobj->allowed_domains', assigned value is <Uninit>
u32 allowed = lobj->allowed_domains;
^
drivers/gpu/drm/radeon/radeon_object.c:517:9: note: Uninitialized variable: allowed
if ((allowed & current_domain) != 0 &&
^
>> drivers/gpu/drm/radeon/radeon_object.c:518:9: warning: Uninitialized variable: domain [uninitvar]
(domain & current_domain) == 0 && /* will be moved */
^
drivers/gpu/drm/radeon/radeon_object.c:497:14: note: Assuming condition is false
if (unlikely(r != 0)) {
^
drivers/gpu/drm/radeon/radeon_object.c:504:21: note: Assignment 'domain=lobj->preferred_domains', assigned value is <Uninit>
u32 domain = lobj->preferred_domains;
^
drivers/gpu/drm/radeon/radeon_object.c:518:9: note: Uninitialized variable: domain
(domain & current_domain) == 0 && /* will be moved */
^
--
>> drivers/gpu/drm/radeon/radeon_gem.c:863:43: warning: Uninitialized variable: rbo->tbo [uninitvar]
domain = radeon_mem_type_to_domain(rbo->tbo.resource->mem_type);
^
--
>> drivers/pci/quirks.c:58:24: warning: Parameter 'end' can be declared with const [constParameter]
struct pci_fixup *end)
^
>> drivers/pci/quirks.c:3251:54: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS);
^
>> drivers/pci/quirks.c:3251:54: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS);
^
vim +/audio_word_length_map +1330 drivers/gpu/drm/bridge/ite-it6505.c
b5c84a9edcd418 Allen Chen 2022-01-14 1326
b5c84a9edcd418 Allen Chen 2022-01-14 1327 static void it6505_setup_audio_channel_status(struct it6505 *it6505)
b5c84a9edcd418 Allen Chen 2022-01-14 1328 {
b5c84a9edcd418 Allen Chen 2022-01-14 1329 enum it6505_audio_sample_rate sample_rate = it6505->audio.sample_rate;
b5c84a9edcd418 Allen Chen 2022-01-14 @1330 u8 audio_word_length_map[] = { 0x02, 0x04, 0x03, 0x0B };
b5c84a9edcd418 Allen Chen 2022-01-14 1331
b5c84a9edcd418 Allen Chen 2022-01-14 1332 /* Channel Status */
b5c84a9edcd418 Allen Chen 2022-01-14 1333 it6505_write(it6505, REG_IEC958_STS0, it6505->audio.type << 1);
b5c84a9edcd418 Allen Chen 2022-01-14 1334 it6505_write(it6505, REG_IEC958_STS1, 0x00);
b5c84a9edcd418 Allen Chen 2022-01-14 1335 it6505_write(it6505, REG_IEC958_STS2, 0x00);
b5c84a9edcd418 Allen Chen 2022-01-14 1336 it6505_write(it6505, REG_IEC958_STS3, sample_rate);
b5c84a9edcd418 Allen Chen 2022-01-14 1337 it6505_write(it6505, REG_IEC958_STS4, (~sample_rate << 4) |
b5c84a9edcd418 Allen Chen 2022-01-14 1338 audio_word_length_map[it6505->audio.word_length]);
b5c84a9edcd418 Allen Chen 2022-01-14 1339 }
b5c84a9edcd418 Allen Chen 2022-01-14 1340
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next reply other threads:[~2022-08-20 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-20 7:41 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-02 10:04 drivers/gpu/drm/bridge/ite-it6505.c:1330:5: warning: Variable 'audio_word_length_map' can be declared with const [constVariable] kernel test robot
2022-04-09 5:11 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202208201508.pilo8lWn-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.