From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3552 amdgpu_dm_backlight_update_status() error: testing array offset 'i' after use.
Date: Thu, 10 Mar 2022 16:24:28 +0800 [thread overview]
Message-ID: <202203101628.ENGWwBfI-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6155 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Alex Deucher <alexander.deucher@amd.com>
CC: Roman Li <Roman.Li@amd.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3bf7edc84a9eb4007dd9a0cb8878a7e1d5ec6a3b
commit: 7fd13baeb7a3a48cae12c36c52f06bf4e9e7d728 drm/amdgpu/display: add support for multiple backlights
date: 7 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 7 months ago
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220310/202203101628.ENGWwBfI-lkp(a)intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3552 amdgpu_dm_backlight_update_status() error: testing array offset 'i' after use.
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3594 amdgpu_dm_backlight_get_brightness() error: testing array offset 'i' after use.
Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1336 amdgpu_dm_fini() error: we previously assumed 'adev->dm.dc' could be null (see line 1324)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1349 amdgpu_dm_fini() warn: variable dereferenced before check 'adev->dm.dc' (see line 1336)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5888 create_stream_for_sink() error: we previously assumed 'aconnector->dc_sink' could be null (see line 5786)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8194 handle_cursor_update() error: we previously assumed 'afb' could be null (see line 8153)
vim +/i +3552 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
4562236b3bc0a2 Harry Wentland 2017-09-12 3542
3d6c91641bc8a8 Alex Deucher 2021-05-11 3543 static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
4562236b3bc0a2 Harry Wentland 2017-09-12 3544 {
620a0d27b211aa David Francis 2018-07-19 3545 struct amdgpu_display_manager *dm = bl_get_data(bd);
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3546 int i;
3d6c91641bc8a8 Alex Deucher 2021-05-11 3547
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3548 for (i = 0; i < dm->num_of_edps; i++) {
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3549 if (bd == dm->backlight_dev[i])
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3550 break;
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3551 }
7fd13baeb7a3a4 Alex Deucher 2021-07-08 @3552 if (i >= AMDGPU_DM_MAX_NUM_EDP)
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3553 i = 0;
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3554 amdgpu_dm_backlight_set_level(dm, i, bd->props.brightness);
3d6c91641bc8a8 Alex Deucher 2021-05-11 3555
3d6c91641bc8a8 Alex Deucher 2021-05-11 3556 return 0;
3d6c91641bc8a8 Alex Deucher 2021-05-11 3557 }
3d6c91641bc8a8 Alex Deucher 2021-05-11 3558
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3559 static u32 amdgpu_dm_backlight_get_level(struct amdgpu_display_manager *dm,
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3560 int bl_idx)
3d6c91641bc8a8 Alex Deucher 2021-05-11 3561 {
0ad3e64eb46d8c Alex Deucher 2020-12-10 3562 struct amdgpu_dm_backlight_caps caps;
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3563 struct dc_link *link = (struct dc_link *)dm->backlight_link[bl_idx];
0ad3e64eb46d8c Alex Deucher 2020-12-10 3564
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3565 amdgpu_dm_update_backlight_caps(dm, bl_idx);
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3566 caps = dm->backlight_caps[bl_idx];
0ad3e64eb46d8c Alex Deucher 2020-12-10 3567
0ad3e64eb46d8c Alex Deucher 2020-12-10 3568 if (caps.aux_support) {
0ad3e64eb46d8c Alex Deucher 2020-12-10 3569 u32 avg, peak;
0ad3e64eb46d8c Alex Deucher 2020-12-10 3570 bool rc;
0ad3e64eb46d8c Alex Deucher 2020-12-10 3571
0ad3e64eb46d8c Alex Deucher 2020-12-10 3572 rc = dc_link_get_backlight_level_nits(link, &avg, &peak);
0ad3e64eb46d8c Alex Deucher 2020-12-10 3573 if (!rc)
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3574 return dm->brightness[bl_idx];
0ad3e64eb46d8c Alex Deucher 2020-12-10 3575 return convert_brightness_to_user(&caps, avg);
0ad3e64eb46d8c Alex Deucher 2020-12-10 3576 } else {
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3577 int ret = dc_link_get_backlight_level(link);
620a0d27b211aa David Francis 2018-07-19 3578
620a0d27b211aa David Francis 2018-07-19 3579 if (ret == DC_ERROR_UNEXPECTED)
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3580 return dm->brightness[bl_idx];
0ad3e64eb46d8c Alex Deucher 2020-12-10 3581 return convert_brightness_to_user(&caps, ret);
0ad3e64eb46d8c Alex Deucher 2020-12-10 3582 }
4562236b3bc0a2 Harry Wentland 2017-09-12 3583 }
4562236b3bc0a2 Harry Wentland 2017-09-12 3584
3d6c91641bc8a8 Alex Deucher 2021-05-11 3585 static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
3d6c91641bc8a8 Alex Deucher 2021-05-11 3586 {
3d6c91641bc8a8 Alex Deucher 2021-05-11 3587 struct amdgpu_display_manager *dm = bl_get_data(bd);
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3588 int i;
3d6c91641bc8a8 Alex Deucher 2021-05-11 3589
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3590 for (i = 0; i < dm->num_of_edps; i++) {
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3591 if (bd == dm->backlight_dev[i])
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3592 break;
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3593 }
7fd13baeb7a3a4 Alex Deucher 2021-07-08 @3594 if (i >= AMDGPU_DM_MAX_NUM_EDP)
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3595 i = 0;
7fd13baeb7a3a4 Alex Deucher 2021-07-08 3596 return amdgpu_dm_backlight_get_level(dm, i);
3d6c91641bc8a8 Alex Deucher 2021-05-11 3597 }
3d6c91641bc8a8 Alex Deucher 2021-05-11 3598
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next reply other threads:[~2022-03-10 8:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 8:24 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-03-04 6:12 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3552 amdgpu_dm_backlight_update_status() error: testing array offset 'i' after use kernel test robot
2022-03-02 6:05 kernel test robot
2021-12-20 8:16 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=202203101628.ENGWwBfI-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.