[PATCH] drm/amdgpu: add missing newline at eof

2020-10-14 Thread trix
From: Tom Rix Representative checkpatch.pl warning WARNING: adding a line without newline at end of file 30: FILE: drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h:30: +#endif Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_1_sh_mask.h | 2 +-

[RFC] treewide: cleanup unreachable breaks

2020-10-17 Thread trix
From: Tom Rix This is a upcoming change to clean up a new warning treewide. I am wondering if the change could be one mega patch (see below) or normal patch per file about 100 patches or somewhere half way by collecting early acks. clang has a number of useful, new warnings see

[PATCH] drm/amdgpu: remove unneeded break

2020-10-19 Thread trix
From: Tom Rix A break is not needed if it is preceded by a return or break Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 1 - drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 7 --- drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 7

[PATCH] drm: remove unneeded break

2020-10-19 Thread trix
From: Tom Rix A break is not needed if it is preceded by a return or break Signed-off-by: Tom Rix --- drivers/gpu/drm/mgag200/mgag200_mode.c | 5 - drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c | 1 - drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c | 3 ---

[PATCH] drm/i915/display: fix uninitialized variable

2020-08-25 Thread trix
From: Tom Rix clang static analysis flags this error intel_combo_phy.c:268:7: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage ret &= check_phy_reg(... ~~~ ^ ret has no initial values,

[PATCH] drm/nouveau: remove redundant check

2020-08-27 Thread trix
From: Tom Rix clang static analysis flags this problem hw.c:271:12: warning: The left operand of '>=' is a garbage value if (pv.M1 >= pll_lim.vco1.min_m ... ~ ^ This is mostly not a problem because an early check in nouveau_hw_fix_bad_vpll() if

[PATCH] drm/gma500: fix double free of gma_connector

2020-10-03 Thread trix
From: Tom Rix clang static analysis reports this problem: cdv_intel_dp.c:2101:2: warning: Attempt to free released memory kfree(gma_connector); ^~~~ In cdv_intel_dp_init() when the call to cdv_intel_edp_panel_vdd_off() fails, the handler calls

[PATCH] drm/amd/display: remove unneeded semicolon

2020-10-27 Thread trix
From: Tom Rix A semicolon is not needed after a switch statement. Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c | 2 +- drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH] drm/amdgpu: remove unneeded semicolon

2020-10-27 Thread trix
From: Tom Rix A semicolon is not needed after a switch statement. Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c

[PATCH] video: fbdev: pvr2fb: initialize variables

2020-07-20 Thread trix
From: Tom Rix clang static analysis reports this repesentative error pvr2fb.c:1049:2: warning: 1st function call argument is an uninitialized value [core.CallAndMessage] if (*cable_arg) ^~~ Problem is that cable_arg depends on the input loop to set the

[PATCH] video: fbdev: sis: fix null ptr dereference

2020-08-05 Thread trix
From: Tom Rix Clang static analysis reports this representative error init.c:2501:18: warning: Array access (from variable 'queuedata') results in a null pointer dereference templ |= ((queuedata[i] & 0xc0) << 3); This is the problem block of code if(ModeNo > 0x13) { ...

[PATCH] drm/gma500: fix error check

2020-08-05 Thread trix
From: Tom Rix Reviewing this block of code in cdv_intel_dp_init() ret = cdv_intel_dp_aux_native_read(gma_encoder, DP_DPCD_REV, ... cdv_intel_edp_panel_vdd_off(gma_encoder); if (ret == 0) { /* if this fails, presume the device is a ghost */ DRM_INFO("failed to retrieve link

[PATCH] drm/radeon: fix double free

2020-07-06 Thread trix
From: Tom Rix clang static analysis flags this error drivers/gpu/drm/radeon/ci_dpm.c:5652:9: warning: Use of memory after it is freed [unix.Malloc] kfree(rdev->pm.dpm.ps[i].ps_priv); ^~ drivers/gpu/drm/radeon/ci_dpm.c:5654:2:

[PATCH] drm/bridge: sil_sii8620: initialize return of sii8620_readb

2020-07-12 Thread trix
From: Tom Rix clang static analysis flags this error sil-sii8620.c:184:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] return ret; ^~ sii8620_readb calls sii8620_read_buf. sii8620_read_buf can return without setting its

[PATCH] drm/v3d: remove second free in v3d_submit_cl_ioctl

2020-07-20 Thread trix
From: Tom Rix clang static analysis reports this error v3d_gem.c:573:4: warning: Attempt to free released memory [unix.Malloc] kfree(bin); ^~ Problem is in the block of code if (ret) { kfree(bin); v3d_job_put(>base);

[PATCH] drm/i915: remove trailing semicolon in macro definition

2020-11-27 Thread trix
From: Tom Rix The macro use will already have a semicolon. Signed-off-by: Tom Rix --- drivers/gpu/drm/i915/intel_device_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index

[PATCH] drm/amdgpu/display: remove trailing semicolon in macro definition

2020-11-27 Thread trix
From: Tom Rix The macro use will already have a semicolon. Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index

[PATCH] omapfb: fbcon: remove trailing semicolon in macro definition

2020-11-27 Thread trix
From: Tom Rix The macro use will already have a semicolon. Signed-off-by: Tom Rix --- drivers/video/fbdev/omap2/omapfb/dss/dispc-compat.c | 2 +- drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH] drm/i915: remove h from printk format specifier

2020-12-15 Thread trix
From: Tom Rix See Documentation/core-api/printk-formats.rst. h should no longer be used in the format specifier for printk. Signed-off-by: Tom Rix --- drivers/gpu/drm/i915/gt/intel_sseu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.c

[PATCH] drm/radeon: remove h from printk format specifier

2020-12-15 Thread trix
From: Tom Rix See Documentation/core-api/printk-formats.rst. h should no longer be used in the format specifier for printk. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- drivers/gpu/drm/radeon/radeon_vce.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff

[PATCH] drm/amdgpu: remove h from printk format specifier

2020-12-15 Thread trix
From: Tom Rix See Documentation/core-api/printk-formats.rst. h should no longer be used in the format specifier for printk. Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4

[RFC] MAINTAINERS tag for cleanup robot

2020-11-21 Thread trix
A difficult part of automating commits is composing the subsystem preamble in the commit log. For the ongoing effort of a fixer producing one or two fixes a release the use of 'treewide:' does not seem appropriate. It would be better if the normal prefix was used. Unfortunately normal is not

Subject: [RFC] clang tooling cleanups

2020-10-27 Thread trix
This rfc will describe An upcoming treewide cleanup. How clang tooling was used to programatically do the clean up. Solicit opinions on how to generally use clang tooling. The clang warning -Wextra-semi-stmt produces about 10k warnings. Reviewing these, a subset of semicolon after a switch looks

[PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count() error count parameters

2021-07-02 Thread trix
From: Tom Rix Static analysis reports this problem amdgpu_ras.c:2324:2: warning: 2nd function call argument is an uninitialized value atomic_set(>ras_ce_count, ce_count); ^~~~ ce_count is normally set by the earlier call to

[PATCH] drm/amd/pm: initialize variable

2021-04-30 Thread trix
From: Tom Rix Static analysis reports this problem amdgpu_pm.c:478:16: warning: The right operand of '<' is a garbage value for (i = 0; i < data.nums; i++) { ^ ~ In some cases data is not set. Initialize to 0 and flag not setting data as an error with the existing

[PATCH] drm/amdkfd: match the signatures of the real and stub kgd2kfd_probe()

2021-09-30 Thread trix
From: Tom Rix When CONFIG_HSA_AMD=n this there is this error amdgpu_amdkfd.c:75:56: error: incompatible type for argument 2 of ‘kgd2kfd_probe’ 75 | adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev, vf); amdgpu_amdkfd.h:349:17: note: declared here 349 | struct kfd_dev

[PATCH] drm/nouveau/kms/nv50-: use DRM_NOUVEAU_BACKLIGHT consistently

2021-07-24 Thread trix
From: Tom Rix A build error when DRM_NOUVEAU_BACKLIGHT is not defined disp.c:1665:52: error: 'struct nouveau_connector' has no member named 'backlight' Use ifdef's similar to elsewhere in disp.c to conditionally use the new backlight support. Move scope of drm to where it is used, inside the

[PATCH] drm/i915: rework the error handling in *_dpll_params

2022-03-04 Thread trix
From: Tom Rix Clang static analysis reports this issue intel_dpll.c:472:31: warning: The left operand of '-' is a garbage value [core.UndefinedBinaryOperatorResult] this_err = abs(clock.dot - target); ~ ^ In a loop clock.dot is set on successful call to

[PATCH] drm/repaper: combine allocs in repaper_spi_transfer()

2022-03-13 Thread trix
From: Tom Rix repaper_spi_transfer() allocates a single byte for the spi header and then another buffer for the payload. Combine the allocs into a single buffer with offsets. To simplify the offsets put the header after the payload. Signed-off-by: Tom Rix --- drivers/gpu/drm/tiny/repaper.c

[PATCH] drm/amdkfd: fix typo in setting enum value

2022-02-17 Thread trix
From: Tom Rix Clang build fails with kfd_packet_manager_v9.c:267:3: error: implicit conversion from enumeration type 'enum mes_map_queues_extended_engine_sel_enum' to different enumeration type 'enum mes_unmap_queues_extended_engine_sel_enum'

[PATCH] drm/amdgpu: fix amdgpu_ras_block_late_init error handler

2022-02-17 Thread trix
From: Tom Rix Clang build fails with amdgpu_ras.c:2416:7: error: variable 'ras_obj' is used uninitialized whenever 'if' condition is true if (adev->in_suspend || amdgpu_in_reset(adev)) { ^ amdgpu_ras.c:2453:6: note: uninitialized use occurs here if

[PATCH] drm/amdgpu: Fix realloc of ptr

2022-02-26 Thread trix
From: Tom Rix Clang static analysis reports this error amdgpu_debugfs.c:1690:9: warning: 1st function call argument is an uninitialized value tmp = krealloc_array(tmp, i + 1, ^~~ realloc will free tmp, so tmp can not be garbage. And the return needs to be

[PATCH] drm/panfrost: cleanup comments

2022-03-01 Thread trix
From: Tom Rix For spdx change tab to space delimiter Use // for *.c Replacements commited to committed, use multiline comment style regsiters to registers initialze to initialize Signed-off-by: Tom Rix --- drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +-

[PATCH] drm/amdgpu: fix printk format for size_t variable

2022-02-21 Thread trix
From: Tom Rix On mips64 allyesconfig, there is this build break amdgpu_discovery.c:671:35: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset); For size_t, use %zu. Fixes:

[PATCH] vgaarbiter: fix vgaarbiter doc build break

2022-03-01 Thread trix
From: Tom Rix make htmldocs fails with Error: Cannot open file ./drivers/gpu/vga/vgaarb.c The location of the file changed drivers/gpu/vga/vgaarb.c -> drivers/pci/vgaarb.c So update the docs with the new location. Fixes: d6e1898bfa5b ("PCI/VGA: Move vgaarb to drivers/pci") Signed-off-by: Tom

[PATCH v2] drm/panfrost: cleanup comments

2022-03-02 Thread trix
From: Tom Rix For spdx change tab to space delimiter Use // for *.c Replacements commited to committed regsiters to registers initialze to initialize Signed-off-by: Tom Rix --- v2: remove multiline comment change drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +-

[PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans

2022-03-03 Thread trix
From: Tom Rix Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is a garbage value if (!(bcap & 0xOA01)) { ^ bcap is only set by a successful call to anx7625_aux_trans(). So check. Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP

[PATCH] drm/amdgpu: check return status before using stable_pstate

2022-02-14 Thread trix
From: Tom Rix Clang static analysis reports this problem amdgpu_ctx.c:616:26: warning: Assigned value is garbage or undefined args->out.pstate.flags = stable_pstate; ^ ~ amdgpu_ctx_stable_pstate can fail without setting stable_pstate. So check. Fixes:

[PATCH v2] drm/amdgpu: Fix realloc of ptr

2022-02-27 Thread trix
From: Tom Rix Clang static analysis reports this error amdgpu_debugfs.c:1690:9: warning: 1st function call argument is an uninitialized value tmp = krealloc_array(tmp, i + 1, ^~~ realloc uses tmp, so tmp can not be garbage. And the return needs to be checked.

[PATCH] drm/amdkfd: rework criu_restore_bos error handling

2022-02-18 Thread trix
From: Tom Rix Clang static analysis reports this problem kfd_chardev.c:2327:2: warning: 1st function call argument is an uninitialized value kvfree(bo_privs); ^~~~ If the copy_from_users(bo_buckets, ...) fails, there is a jump to the generic error handler at exit:. The

[PATCH] drm/amdgpu: initialize reg_access_ctrl

2022-01-29 Thread trix
From: Tom Rix clang build fails with amdgpu_virt.c:878:51: error: variable 'reg_access_ctrl' is uninitialized when used here ... + 4 * reg_access_ctrl->scratch_reg0; ^~~ The reg_access_ctrl ptr is never initialized, so initialize once we know it is supported. Fixes:

[PATCH] drm/ast: fix using freed memory

2022-02-03 Thread trix
From: Tom Rix clang static analysis reports this problem ast_mode.c:1235:3: warning: Use of memory after it is freed drm_connector_update_edid_property(_connector->base, edid); ^~ The second condition on if (!flags &&

[PATCH] drm/amdkfd: fix freeing an unset pointer

2022-02-09 Thread trix
From: Tom Rix clang static analysis reports this problem kfd_chardev.c:2092:2: warning: 1st function call argument is an uninitialized value kvfree(bo_privs); ^~~~ When bo_buckets alloc fails, it jumps to an error handler that frees the yet to be allocated

[PATCH] drm/amdkfd: fix loop error handling

2022-02-10 Thread trix
From: Tom Rix Clang static analysis reports this problem kfd_chardev.c:2594:16: warning: The expression is an uninitialized value. The computed value will also be garbage while (ret && i--) { ^~~ i is a loop variable and this block unwinds a problem in the loop.

[PATCH] drm/amd/pm: fix error handling

2022-02-05 Thread trix
From: Tom Rix clang static analysis reports this error amdgpu_smu.c:2289:9: warning: Called function pointer is null (null dereference) return smu->ppt_funcs->emit_clk_levels( ^~~~ There is a logic error in the earlier check of

[PATCH] drm/amdkfd: simplify else if to else check of MIGRATION_COPY_DIR

2022-01-22 Thread trix
From: Tom Rix The enum MIGRATION_COPY_DIR type has 2 values. So the else-if can be converted to an else. Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c

[PATCH] drm/amd/pm: set min, max to 0 if there is no get_dpm_ultimate_freq function

2022-01-24 Thread trix
From: Tom Rix clang static analysis reports this represenative problem amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value return clk_freq * 100; ^ If there is no get_dpm_ultimate_freq function, smu_get_dpm_freq_range returns success without

[PATCH v2] drm/amd/pm: return -ENOTSUPP if there is no get_dpm_ultimate_freq function

2022-01-24 Thread trix
From: Tom Rix clang static analysis reports this represenative problem amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value return clk_freq * 100; ^ If there is no get_dpm_ultimate_freq function, smu_get_dpm_freq_range returns success without