[PATCH] vga_switcheroo: Fix impossible judgment condition

2023-10-25 Thread Su Hui
'id' is enum type like unsigned int, so it will never be less than zero. Fixes: 4aaf448fa975 ("vga_switcheroo: set audio client id according to bound GPU id") Signed-off-by: Su Hui --- drivers/gpu/vga/vga_switcheroo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] drm/radeon/ni_dpm: add an error code check in ni_dpm_init

2023-10-31 Thread Su Hui
ni_patch_single_dependency_table_based_on_leakage() return zero or negative error code. But ni_patch_dependency_tables_based_on_leakage() doesn't check the return value of the first function call. It's same for ni_dpm_init(). It's better to add this error code check. Signed-off-by: Su Hui

Re: [PATCH] vga_switcheroo: Fix impossible judgment condition

2023-10-26 Thread Su Hui
On 2023/10/26 12:44, Dan Carpenter wrote: On Thu, Oct 26, 2023 at 10:10:57AM +0800, Su Hui wrote: 'id' is enum type like unsigned int, so it will never be less than zero. Fixes: 4aaf448fa975 ("vga_switcheroo: set audio client id according to bound GPU id") Signed-off-by: Su Hui ---

[PATCH v2] vga_switcheroo: Fix impossible judgment condition

2023-10-26 Thread Su Hui
'id' is enum type like unsigned int, so it will never be less than zero. It's better to check VGA_SWITCHEROO_UNKNOWN_ID too. Fixes: 4aaf448fa975 ("vga_switcheroo: set audio client id according to bound GPU id") Signed-off-by: Su Hui --- v2: - add check of VGA_SWITCHEROO_UNKNOW

[PATCH] drm/nouveau/nvif: avoid possible memory leak of 'args'

2023-10-24 Thread Su Hui
Use kfree() to free 'args' before return '-EINVAL'. Signed-off-by: Su Hui --- drivers/gpu/drm/nouveau/nvif/vmm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/nvif/vmm.c b/drivers/gpu/drm/nouveau/nvif/vmm.c index 99296f03371a..a0afe3bf0d78 100644 --- a/drivers/gpu

[PATCH] drm/amdgpu: Avoid possible buffer overflow

2023-08-21 Thread Su Hui
quot;) Signed-off-by: Su Hui --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c index 8e1cfc87122d..ba95526c3d45 100644 --- a/driver

Re: [PATCH] drm/amdgpu: Avoid possible buffer overflow

2023-08-21 Thread Su Hui
On 2023/8/21 14:47, Christophe JAILLET wrote: Le 21/08/2023 à 08:19, Su Hui a écrit : smatch error: drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1257 amdgpu_discovery_reg_base_init() error: testing array offset 'adev->vcn.num_vcn_inst' after use. change the assignment order to avoid buf

[PATCH] drm/ast: Avoid possible NULL dereference

2023-08-21 Thread Su Hui
. Fixes: 12f8030e05c6 ("drm/ast: Actually load DP501 firmware when required") Signed-off-by: Su Hui --- drivers/gpu/drm/ast/ast_dp501.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c index 1bc35

[PATCH v2] drm/amdgpu: Avoid possible buffer overflow

2023-08-21 Thread Su Hui
quot;) Signed-off-by: Su Hui --- changes in v2: - fix the error about ip->revision (thanks to Christophe JAILLET). drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gp

Re: [PATCH] drm/ast: Avoid possible NULL dereference

2023-08-21 Thread Su Hui
On 2023/8/21 15:04, Christophe JAILLET wrote: Le 21/08/2023 à 08:22, Su Hui a écrit : smatch error: drivers/gpu/drm/ast/ast_dp501.c:227 ast_launch_m68k() error: we previously assumed 'ast->dp501_fw' could be null (see line 223) when "!ast->dp501_fw" and "ast_load_dp50

Re: [PATCH v2] drm/amdgpu: Avoid possible buffer overflow

2023-08-21 Thread Su Hui
On 2023/8/21 17:31, Christian König wrote: Am 21.08.23 um 09:37 schrieb Su Hui: smatch error: drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1257 amdgpu_discovery_reg_base_init() error: testing array offset 'adev->vcn.num_vcn_inst' after use. change the assignment order to avoid buf

Re: [PATCH] drm/virtio: remove some redundant code

2023-07-11 Thread Su Hui
won't fail, and virtio_gpu_get_vbuf never return error code, so remove the error judgment. How about this one? Thanks for your advice. Su Hui Regards, Markus

Re: [PATCH] drm/virtio: remove some redundant code

2023-07-11 Thread Su Hui
On 2023/7/11 19:13, Dan Carpenter wrote: On Tue, Jul 11, 2023 at 05:00:31PM +0800, Su Hui wrote: virtio_gpu_get_vbuf always be successful, so remove the error judgment. No, just ignore the static checker false positive in this case. The intent of the code is clear that if it did have

Re: [PATCH] drm/i915/tv: avoid possible division by zero

2023-07-17 Thread Su Hui
On 2023/7/17 22:52, Andrzej Hajda wrote: On 17.07.2023 08:22, Su Hui wrote: Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22 Division by zero. Assuming tv_mode->oversample=1 and (!tv_mode->progressive)=1, then division by zero will happen. Fixes: 1bba5543e4fe

[PATCH v2] drm/i915/tv: avoid possible division by zero

2023-07-17 Thread Su Hui
Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22 Division by zero. Assuming tv_mode->oversample=1 and (!tv_mode->progressive)=1, then division by zero will happen. Fixes: 1bba5543e4fe ("drm/i915: Fix TV encoder clock computation") Signed-off-by: Su Hui

Re: [PATCH] drm/i915/tv: avoid possible division by zero

2023-07-18 Thread Su Hui
On 2023/7/18 13:39, Dan Carpenter wrote: On Mon, Jul 17, 2023 at 04:52:51PM +0200, Andrzej Hajda wrote: On 17.07.2023 08:22, Su Hui wrote: Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22 Division by zero. Assuming tv_mode->oversample=1 and (!tv_mode->progress

Re: [PATCH] drm/i915/tv: avoid possible division by zero

2023-07-18 Thread Su Hui
On 2023/7/18 19:28, Andrzej Hajda wrote: On 18.07.2023 12:10, Su Hui wrote: On 2023/7/18 13:39, Dan Carpenter wrote: On Mon, Jul 17, 2023 at 04:52:51PM +0200, Andrzej Hajda wrote: On 17.07.2023 08:22, Su Hui wrote: Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22

[PATCH] drm/virtio: remove some redundant code

2023-07-11 Thread Su Hui
virtio_gpu_get_vbuf always be successful, so remove the error judgment. Signed-off-by: Su Hui --- drivers/gpu/drm/virtio/virtgpu_vq.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index b1a00c0c25a7

[PATCH] drm/i915/tv: avoid possible division by zero

2023-07-17 Thread Su Hui
Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22 Division by zero. Assuming tv_mode->oversample=1 and (!tv_mode->progressive)=1, then division by zero will happen. Fixes: 1bba5543e4fe ("drm/i915: Fix TV encoder clock computation") Signed-off-by: Su Hui

Re: [PATCH] drm/virtio: remove some redundant code

2023-07-12 Thread Su Hui
On 2023/7/12 14:36, Dan Carpenter wrote: On Wed, Jul 12, 2023 at 09:18:42AM +0800, Su Hui wrote: On 2023/7/11 19:13, Dan Carpenter wrote: On Tue, Jul 11, 2023 at 05:00:31PM +0800, Su Hui wrote: virtio_gpu_get_vbuf always be successful, so remove the error judgment. No, just ignore

[PATCH] drm: Remove unnecessary (void*) conversions

2023-05-26 Thread Su Hui
Pointer variables of (void*) type do not require type cast. Signed-off-by: Su Hui --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- drivers/gpu/drm/amd/pm/amdgpu_pm.c| 2 +- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 ++-- drivers

[PATCH] drm/nouveau/nvif: use struct_size()

2023-05-30 Thread Su Hui
Use struct_size() instead of hand writing it. This is less verbose and more informative. Signed-off-by: Su Hui --- drivers/gpu/drm/nouveau/nvif/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif

Re: [PATCH] drm/nouveau/nvif: use struct_size()

2023-05-31 Thread Su Hui
On 2023/5/31 16:31, Dan Carpenter wrote: On Wed, May 31, 2023 at 12:38:26PM +0800, Su Hui wrote: Use struct_size() instead of hand writing it. This is less verbose and more informative. Signed-off-by: Su Hui --- drivers/gpu/drm/nouveau/nvif/object.c | 2 +- 1 file changed, 1 insertion

[PATCH v3] drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow

2023-06-07 Thread Su Hui
Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5. Fixes: cea86c5bb442 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip") Signed-off-by: Su Hui --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/bridge/t

Re: [PATCH v2] drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow

2023-06-07 Thread Su Hui
On 2023/6/7 22:03, Doug Anderson wrote: Hi, On Tue, Jun 6, 2023 at 6:25 PM Su Hui wrote: Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5. Fixes: cea86c5bb442 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip") Signed-off-by: Su Hui --- drivers/gpu/drm/bridge/t

Re: [PATCH] drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow

2023-06-06 Thread Su Hui
Hi, On 2023/6/6 23:28, Doug Anderson wrote: Hi, On Tue, Jun 6, 2023 at 12:56 AM Su Hui wrote: Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5. Fixes: cea86c5bb442 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip") Signed-off-by: Su Hui --- drivers/gpu/

[PATCH v2] drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow

2023-06-06 Thread Su Hui
Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5. Fixes: cea86c5bb442 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip") Signed-off-by: Su Hui --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/

[PATCH] drm/msm: Remove unnecessary (void*) conversions

2023-05-22 Thread Su Hui
Pointer variables of (void*) type do not require type cast. Signed-off-by: Su Hui --- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +- drivers

[PATCH] drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow

2023-06-06 Thread Su Hui
Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5. Fixes: cea86c5bb442 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip") Signed-off-by: Su Hui --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/

Re: [PATCH] drm: Remove unnecessary (void*) conversions

2023-05-28 Thread Su Hui
On 2023/5/26 15:27, Christian König wrote: Am 26.05.23 um 05:32 schrieb Su Hui: Pointer variables of (void*) type do not require type cast. Please split that up by subsystem/driver. Taking it through the misc tree might just cause merge conflicts. Sorry for that, I will split it and send

Re: [Intel-gfx] [PATCH v2] drm/i915/tv: avoid possible division by zero

2023-07-25 Thread Su Hui
for your help! Su Hui regards, dan carpenter diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c index 36b479b46b60..6997b6cb1df2 100644 --- a/drivers/gpu/drm/i915/display/intel_tv.c +++ b/drivers/gpu/drm/i915/display/intel_tv.c @@ -988,7 +988,13

Re: [Intel-gfx] [PATCH v2] drm/i915/tv: avoid possible division by zero

2023-07-24 Thread Su Hui
On 2023/7/25 01:35, Andi Shyti wrote: On Tue, Jul 18, 2023 at 09:32:17AM +0800, Su Hui wrote: Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22 Division by zero. Assuming tv_mode->oversample=1 and (!tv_mode->progressive)=1, then division by zero will happen.

Re: [PATCH] drm/amd/amdgpu: Use “__packed“ instead of "pragma pack()"

2023-06-21 Thread Su Hui
r pointers. That's how we used to do it prior to 2003. But these days it feels strange and dangerous to see these sorts of warnings. Got it. And it is really strange when I first saw these warnings. Thanks for your explanation! Su Hui Smatch also disabled some uninitialized variable checks. These

[PATCH] drm/amd/amdgpu: Properly tune the size of struct

2023-06-19 Thread Su Hui
Smatch error: gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:316:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" Fixes: 1721bc1b2afa ("drm/amdgpu: Update VF2PF interfac

[PATCH] drm/amd/amdgpu: Use “__packed“ instead of "pragma pack()"

2023-06-20 Thread Su Hui
use "__packed" is clearer amd better than “pragma pack()”. Signed-off-by: Su Hui --- As Dan Carpenter mentioned: '"Mark the associated types properly packed individually, rather than use the disgusting "pragma pack()" that should never be used." https://lore.kernel

[PATCH] drm/amdgpu: remove unnecessary (void*) conversions

2023-05-15 Thread Su Hui
No need cast (void*) to (struct amdgpu_device *). Signed-off-by: Su Hui --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers

[PATCH] drm/radeon: Remove unnecessary (void*) conversions

2023-05-17 Thread Su Hui
No need cast (void*) to (struct radeon_device *) or (struct radeon_ring *). Signed-off-by: Su Hui --- drivers/gpu/drm/radeon/r100.c | 8 drivers/gpu/drm/radeon/r300.c | 2 +- drivers/gpu/drm/radeon/r420.c | 2 +- drivers/gpu/drm/radeon/r600.c | 2

[PATCH] backlight: ili922x: add an error code check in ili922x_write

2023-11-29 Thread Su Hui
Clang static analyzer complains that value stored to 'ret' is never read. Return the error code when spi_sync() failed. Signed-off-by: Su Hui --- drivers/video/backlight/ili922x.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/video/backlight/ili922x.c b/drivers/video

[PATCH] drm/nouveau/disp: fix an error problem in nvkm_uconn_new()

2024-04-17 Thread Su Hui
nnectors based on nvkm info") Signed-off-by: Su Hui --- drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c index 2dab6612c4fc.

[PATCH] drm/amdkfd: return negative error code in svm_ioctl()

2024-03-25 Thread Su Hui
svm_ioctl() should return negative error code in default case. Fixes: 42de677f7999 ("drm/amdkfd: register svm range") Signed-off-by: Su Hui --- Ps: When I try to compile this file, there is a error : drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:28:10: fatal error: amdgpu_sync.h: No

Re: [PATCH] drm/amdkfd: return negative error code in svm_ioctl()

2024-03-25 Thread Su Hui
On 2024/3/25 22:09, Philip Yang wrote: On 2024-03-25 02:31, Su Hui wrote: Good catch, ioctl should return -errno. I will apply it to drm-next. Reviewed-by: Philip Yang --- Ps: When I try to compile this file, there is a error : drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:28:10: fatal error