[PATCH] drm/amd: remove possible condition with no effect (if == else)

2022-08-23 Thread Bernard Zhao
This patch fix cocci warning: drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c:1816:6-8: WARNING: possible condition with no effect (if == else). Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 2 -- 1 file changed, 2 deletions(-) diff --git

[PATCH] drm/amd: remove duplicated argument to &

2022-08-23 Thread Bernard Zhao
This patch trf to fis cocci warning: drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c: 2349:8-34: duplicated argument to && or || drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c: 3680:8-55: duplicated argument to && or || Signed-off-by: Bernard Zhao

[PATCH] drm/amd: fix potential memory leak

2022-08-23 Thread Bernard Zhao
This patch fix potential memory leak (clk_src) when function run into last return NULL. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c b/drivers

[PATCH v2] drm/amd: remove duplicated argument to &

2022-08-23 Thread Bernard Zhao
This patch trf to fis cocci warning: drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c: 2349:8-34: duplicated argument to && or || drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c: 3680:8-55: duplicated argument to && or || Signed-off-by: Bernard Zhao

[PATCH] drm/amd: fix potential memory leak

2022-08-23 Thread Bernard Zhao
This patch fix potential memory leak (clk_src) when function run into last return NULL. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c b/drivers

[PATCH] drm/amd: remove possible condition with no effect (if == else)

2022-08-23 Thread Bernard Zhao
This patch fix cocci warning: drivers/gpu/drm/amd/display/dc/core/dc.c:3335:2-4: WARNING: possible condition with no effect (if == else). Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/core/dc.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers

[PATCH] drm/amd/display: remove no need NULL check before kfree

2021-11-16 Thread Bernard Zhao
This change is to cleanup the code a bit. Signed-off-by: Bernard Zhao --- .../drm/amd/display/dc/dcn10/dcn10_resource.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display

[PATCH] drm/amd/display: cleanup the code a bit

2021-11-16 Thread Bernard Zhao
In function dc_sink_destruct, kfree will check pointer, no need to check again. This change is to cleanup the code a bit. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/gpu/drm

[PATCH v2] drm/amd/amdgpu: cleanup the code style a bit

2021-11-15 Thread Bernard Zhao
This change is to cleanup the code style a bit. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amd/amdgpu: remove useless break after return

2021-11-15 Thread Bernard Zhao
This change is to remove useless break after return. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index b200b9e722d9..8318ee8339f1

[PATCH] drm/amd/amdgpu: cleanup the code style a bit

2021-11-15 Thread Bernard Zhao
This change is to cleanup the code style a bit. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index

[PATCH] drm/amd/amdgpu: fix potential memleak

2021-11-15 Thread Bernard Zhao
In function amdgpu_get_xgmi_hive, when kobject_init_and_add failed There is a potential memleak if not call kobject_put. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b

[PATCH] drm/radeon: delete useless function return values & remove meaningless if(r) check code

2021-06-21 Thread Bernard Zhao
-by: Bernard Zhao --- drivers/gpu/drm/radeon/cik.c | 4 +--- drivers/gpu/drm/radeon/evergreen.c| 4 +--- drivers/gpu/drm/radeon/ni.c | 4 +--- drivers/gpu/drm/radeon/r100.c | 4 +--- drivers/gpu/drm/radeon/r300.c | 4 +--- drivers/gpu/drm/radeon/r420.c | 5

[PATCH 2/4] drm/radeon: remove meaningless if(r) check code

2021-06-21 Thread Bernard Zhao
Function radeon_fence_driver_init always returns success, remove meaningless if(r) check code. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/radeon/r100.c | 4 +--- drivers/gpu/drm/radeon/r300.c | 4 +--- drivers/gpu/drm/radeon/r420.c | 5 + drivers/gpu/drm/radeon/r520.c | 4 +--- drivers

[PATCH 0/4] delete useless function return values & remove meaningless if(r) check code

2021-06-21 Thread Bernard Zhao
-off-by: Bernard Zhao Bernard Zhao (4): drm/radeon: remove meaningless if(r) check code drm/radeon: remove meaningless if(r) check code drm/radeon: remove meaningless if(r) check code drm/radeon: delete useless return values drivers/gpu/drm/radeon/cik.c | 4 +--- drivers/gpu/drm

[PATCH 1/4] drm/radeon: remove meaningless if(r) check code

2021-06-21 Thread Bernard Zhao
Function radeon_fence_driver_init always returns success, remove meaningless if(r) check code. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/radeon/cik.c | 4 +--- drivers/gpu/drm/radeon/evergreen.c | 4 +--- drivers/gpu/drm/radeon/ni.c| 4 +--- drivers/gpu/drm/radeon/si.c

[PATCH 3/4] drm/radeon: remove meaningless if(r) check code

2021-06-21 Thread Bernard Zhao
Function radeon_fence_driver_init always returns success, remove meaningless if(r) check code. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/radeon/rs400.c | 4 +--- drivers/gpu/drm/radeon/rs600.c | 4 +--- drivers/gpu/drm/radeon/rs690.c | 4 +--- drivers/gpu/drm/radeon/rv515.c | 4

[PATCH 4/4] drm/radeon: delete useless return values

2021-06-21 Thread Bernard Zhao
Function radeon_fence_driver_init always returns success, the function type maybe coule be changed to void. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_fence.c | 5 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git

[PATCH] drm/amd/display: remove no need variable

2021-06-07 Thread Bernard Zhao
remove no need variable, just return the DC_OK Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc

[PATCH] drm/amd: remove not needed conversion to bool

2021-04-02 Thread Bernard Zhao
Fix coccicheck warning: drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c:573:39-44: WARNING: conversion to bool not needed here drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c:575:39-44: WARNING: conversion to bool not needed here Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c | 4

[PATCH] drm/amd: cleanup coding style a bit

2021-03-31 Thread Bernard Zhao
ocks + if (obj && obj->use < 0) { +DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name); + } Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) d

[PATCH] amd/amdgpu: code refactoring to clean code style a bit

2021-03-31 Thread Bernard Zhao
- consider code refactoring + if (vbios_voltage_id <= leakage_bin[j]) { Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 84 1 file changed, 35 insertions(+), 49 deletions(-) diff --git

[PATCH] drm/amd: use kmalloc_array over kmalloc with multiply

2021-03-31 Thread Bernard Zhao
Fix patch check warning: WARNING: Prefer kmalloc_array over kmalloc with multiply + buf = kmalloc(MAX_KFIFO_SIZE * sizeof(*buf), GFP_KERNEL); Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] amd/display: remove unneeded variable: "pattern"

2021-02-02 Thread Bernard Zhao
Remove unneeded variable: "pattern". Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_

[PATCH] amd/amdgpu: optimise CONFIG_X||CONFIG_X_MODULE to IS_ENABLED(X)

2020-11-18 Thread Bernard Zhao
Optimise CONFIG_ || CONFIG__MODULE to IS_ENABLED(). This change also fix check_patch.pl warning: WARNING: Prefer IS_ENABLED() to CONFIG_ || CONFIG__MODULE +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined (CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) Signed-off-by: Bernard Zhao --- drivers/gpu

[PATCH] amd/amdgpu: use kmalloc_array to replace kmalloc with multiply

2020-11-17 Thread Bernard Zhao
ay has multiply overflow check, which will be safer. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index d0aea5

[PATCH] amdgpu/amdgpu_ids: fix kmalloc_array not uses number as first arg

2020-11-17 Thread Bernard Zhao
Fix check_patch.pl warning: kmalloc_array uses number as first arg, sizeof is generally wrong. +fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, GFP_KERNEL); Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH] amd/display/amdgpu_dm: delete same check in if condition

2020-11-10 Thread Bernard Zhao
In function amdgpu_dm_connector_get_modes, drm_edid_is_valid will check weather (!edid), no need to check again in the if branch. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm

[PATCH] drm/amd: fix typoes

2020-11-02 Thread Bernard Zhao
Fix typoes. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c index 2c6db379afae..e994d233aa21

[PATCH] drm/amd: move DRM_ERROR log out of the mutex protect area

2020-11-02 Thread Bernard Zhao
In function amdgpu_register_gpu_instance, there is no need to protect DRM_ERROR in mutex mgpu_info.mutex. This change is to make the code to run a bit fast. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] drm/amd: remove unnecessary conversion from bool value to bool

2020-10-14 Thread Bernard Zhao
In functions vegam_is_dpm_running & vegam_populate_avfs_parameters, maybe there is no need to conver bool condition to bool variable or bool return value. This change is to make the code a bit more readable. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c

[PATCH] drm/amd/display: remove no need return value

2020-10-12 Thread Bernard Zhao
Functions (disable_all_writeback_pipes_for_stream & dc_enable_stereo & dc_post_update_surfaces_to_stream) always return true, there is no need to keep the return value. This change is to make the code a bit more readable. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/c

[PATCH] drm/amd/display: remove no need return value

2020-10-10 Thread Bernard Zhao
Functions (disable_all_writeback_pipes_for_stream & dc_enable_stereo & dc_post_update_surfaces_to_stream) always return true, there is no need to keep the return value. This change is to make the code a bit more readable. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/c

[PATCH] drm/radeon:fix typoes in comments

2020-09-22 Thread Bernard Zhao
Change the comment typo: "programm" -> "program". Signed-off-by: Bernard Zhao --- drivers/gpu/drm/radeon/uvd_v1_0.c | 4 ++-- drivers/gpu/drm/radeon/uvd_v2_2.c | 2 +- drivers/gpu/drm/radeon/uvd_v4_2.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a

[PATCH] drm/amd:fix typoes in comments

2020-09-22 Thread Bernard Zhao
Change the comment typo: "programm" -> "program". Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++

[PATCH v2] drm/amd/display: optimize code runtime a bit

2020-09-22 Thread Bernard Zhao
In the function dal_ddc_service_query_ddc_data, get rid of dal_ddc_i2c_payloads_destroy, call dal_vector_destruct() directly. This change is to make the code run a bit fast. Signed-off-by: Bernard Zhao Changes since V1: *get rid of dal_ddc_i2c_payloads_destroy, call dal_vector_destruct

[PATCH] drm/amd/display: optimize code runtime a bit

2020-09-21 Thread Bernard Zhao
Static function dal_ddc_i2c_payloads_destroy is only called in dal_ddc_service_query_ddc_data, the parameter is , there is no point NULL risk, so no need to check. This change is to make the code run a bit fast. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c

[PATCH] drm/amd/display: optimize code runtime a bit

2020-09-10 Thread Bernard Zhao
In fnction is_cr_done & is_ch_eq_done, when done = false happened once, no need to circle left ln_count. This change is to make the code run a bit fast. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +- 1 file changed, 5 insertions(+

[PATCH v3] drm/amd: fix potential memleak in err branch

2020-06-22 Thread Bernard Zhao
atched. These changes are to add kobject_put in kobject_init_and_add failed branch, fix potential memleak. Signed-off-by: Bernard Zhao --- Changes since V2: *remove duplicate kobject_put in kfd_procfs_init. Link for V1: *https://lore.kernel.org/patchwork/patch/1258608/ --- drivers/gpu/drm/amd/amdkfd/k

[PATCH v2] drm/amd: fix potential memleak in err branch

2020-06-22 Thread Bernard Zhao
atched. These changes are to add kobject_put in kobject_init_and_add failed branch, fix potential memleak. Signed-off-by: Bernard Zhao --- Changes since V1: *Remove duplicate changed file kfd_topology.c, this file`s fix already applied to the main line. --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2

[PATCH] drm/amd: fix potential memleak in err branch

2020-06-19 Thread Bernard Zhao
atched. These changes are to add kobject_put in kobject_init_and_add failed branch, fix potential memleak. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 20 +++- 2 files changed, 17 insertions(+), 5 del

[PATCH] drm/amd: add missing fill of the array`s first element

2020-06-12 Thread Bernard Zhao
In function fill_iram_v_2, the ram_table->bright_neg_gain`s first element [0][0] seems to be missing. This change is just to make the code a bit readable. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 1 + 1 file changed, 1 insertion(+) diff --

[PATCH] drm/amd: remove unnecessary conversion to bool

2020-06-12 Thread Bernard Zhao
In function is_support_sw_smu, remove unnecessary conversion to bool return, this change is to make the code a bit readable. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd

[PATCH v2] drm/amd/amdgpu: cleanup coding style a bit

2020-05-07 Thread Bernard Zhao
There is DEVICE_ATTR mechanism in separate attribute define. So this change is to use attr array, also use sysfs_create_files in init function & sysfs_remove_files in fini function. This maybe make the code a bit readable. Signed-off-by: Bernard Zhao Changes since V1: *Use DEVICE_ATTR mecha

[PATCH] drm/radeon: cleanup coding style a bit

2020-04-27 Thread Bernard Zhao
Maybe no need to check ws before kmalloc, kmalloc will check itself, kmalloc`s logic is if ptr is NULL, kmalloc will just return Signed-off-by: Bernard Zhao --- drivers/gpu/drm/radeon/atom.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/atom.c b

[PATCH v5] drm/amdgpu: cleanup coding style in amdkfd a bit

2020-04-22 Thread Bernard Zhao
Make the code a bit more readable by using a common error handling pattern. With that done the patch is Reviewed-by: Christian König . Signed-off-by: Bernard Zhao Changes since V1: *commit message improve *code style refactoring Changes since V2: *code style adjust Changes since V3: *find

[PATCH V4] amdgpu: reduce no need mutex_lock area

2020-04-21 Thread Bernard Zhao
Maybe we could reduce the mutex_lock(>lock)`s protected code area, and no need to protect pr_debug. Signed-off-by: Bernard Zhao Changes since V1: *commit message improve Changes since V2: *move comment along with the mutex_unlock Changes since V3: *lock protect the if check, there is s

[PATCH v4] amdgpu: remove unnecessary condition check

2020-04-21 Thread Bernard Zhao
There is no need to if check again, maybe we could merge into the above else branch. Signed-off-by: Bernard Zhao Changes since V1: *commit message improve *code style refactoring Changes since V2: *code style adjust Changes since V3: *find the best way to merge unnecessary if/else check

[PATCH V3] amdgpu: remove unnecessary condition check

2020-04-21 Thread Bernard Zhao
There is no need to if check again, maybe we could merge into the above else branch. Signed-off-by: Bernard Zhao Changes since V1: *commit message improve *code style refactoring Changes since V2: *code style adjust Link for V1: *https://lore.kernel.org/patchwork/patch/1226587/ --- .../gpu

[PATCH] amdgpu: fixes memleak issue when init failed

2020-04-21 Thread Bernard Zhao
VRAM manager and DRM MM when init failed, there is no operaction to free kzalloc memory & remove device file. This will lead to memleak & cause stability issue. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 24 1 file changed, 19 in

[PATCH V2] amdgpu: optimization-- reduce noneed mutex_lock area

2020-04-21 Thread Bernard Zhao
Maybe we could reduce the mutex_lock(>lock)`s protected code area, and noneed to protect pr_debug. Signed-off-by: Bernard Zhao Changes since V1: *commit message improve Link for V1: *https://lore.kernel.org/patchwork/patch/1226588/ --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

[PATCH v2] amdgpu: fixes error branch not return errno issue

2020-04-21 Thread Bernard Zhao
The "if(!encoder)" branch return the same value 0 of the success branch, maybe return -EINVAL is more better. Signed-off-by: Bernard Zhao --- Changes since V1: * commit message improve --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 14 +++--- 1 file changed, 7 insert

[PATCH V2] amdgpu: remove unnecessary condition check

2020-04-21 Thread Bernard Zhao
There is no need to if check again, maybe we could merge into the above else branch. Signed-off-by: Bernard Zhao --- Changes since V1: *commit message improve *code style refactoring Link for V1: * https://lore.kernel.org/patchwork/patch/1226587/ --- drivers/gpu/drm/amd/amdgpu

[PATCH V3] amdgpu:optimization-- reduce no need mutex_lock area

2020-04-21 Thread Bernard Zhao
Maybe we could reduce the mutex_lock(>lock)`s protected code area, and no need to protect pr_debug. Signed-off-by: Bernard Zhao Changes since V1: *commit message improve Changes since V2: *move comment along with the mutex_unlock Link for V1: *https://lore.kernel.org/patchwork/patch/1226

[PATCH V2] amdgpu, fix unnessary check "info" NULL branch

2020-04-20 Thread Bernard Zhao
kvfree ensure that the null pointer will do nothing. If addr is NULL, first is_vmalloc_addr will not enter, and kfree function just return when addr is NULL. There will be no risk here. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +-- 1 file changed, 1 insertion

[PATCH] amdgpu_cs_bo_handles_chunk, remove check info NULL branch

2020-04-19 Thread Bernard Zhao
kvfree ensure that the null pointer will do nothing. If addr is NULL, first is_vmalloc_addr will not enter, and kfree function just return when addr is NULL. There will be no risk here. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +-- 1 file changed, 1 insertion

[PATCH] amdgpu_connector_set_property, fix error branch not return errno

2020-04-19 Thread Bernard Zhao
The "if(!encoder)" branch return the same value 0 of the success branch, maybe return -EINVAL is more better. Signed-off-by: Bernard Zhao w --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/g

[PATCH] reserve_bo_and_cond_vms: Remove unnecessary condition check

2020-04-18 Thread Bernard Zhao
There is no need to if check again, maybe we could merge into the above else branch. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b

[PATCH] amdgpu_amdkfd_gpuvm_free_memory_of_gpu, reduce noneed mutex_lock area

2020-04-18 Thread Bernard Zhao
Maybe we could reduce the mutex_lock(>lock)`s protected code area, and noneed to protect pr_debug. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amd

[PATCH] Optimized division operation to shift operation

2020-04-14 Thread Bernard Zhao
On some processors, the / operate will call the compiler`s div lib, which is low efficient, We can replace the / operation with shift, so that we can replace the call of the division library with one shift assembly instruction. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/gmc_v6_0