* [PATCH] drm/amdgpu: remove redundant NULL check
@ 2022-11-23 7:44 ` zys.zljxml
0 siblings, 0 replies; 4+ messages in thread
From: zys.zljxml @ 2022-11-23 7:44 UTC (permalink / raw)
To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
Cc: amd-gfx, dri-devel, linux-kernel, Yushan Zhou
From: Yushan Zhou <katrinzhou@tencent.com>
release_firmware() checks whether firmware pointer is NULL.
Remove the redundant NULL check in psp_sw_fini().
Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++--------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index effa7df3ddbf..77b966ab5439 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -484,26 +484,22 @@ static int psp_sw_fini(void *handle)
struct psp_gfx_cmd_resp *cmd = psp->cmd;
psp_memory_training_fini(psp);
- if (psp->sos_fw) {
- release_firmware(psp->sos_fw);
- psp->sos_fw = NULL;
- }
- if (psp->asd_fw) {
- release_firmware(psp->asd_fw);
- psp->asd_fw = NULL;
- }
- if (psp->ta_fw) {
- release_firmware(psp->ta_fw);
- psp->ta_fw = NULL;
- }
- if (psp->cap_fw) {
- release_firmware(psp->cap_fw);
- psp->cap_fw = NULL;
- }
- if (psp->toc_fw) {
- release_firmware(psp->toc_fw);
- psp->toc_fw = NULL;
- }
+
+ release_firmware(psp->sos_fw);
+ psp->sos_fw = NULL;
+
+ release_firmware(psp->asd_fw);
+ psp->asd_fw = NULL;
+
+ release_firmware(psp->ta_fw);
+ psp->ta_fw = NULL;
+
+ release_firmware(psp->cap_fw);
+ psp->cap_fw = NULL;
+
+ release_firmware(psp->toc_fw);
+ psp->toc_fw = NULL;
+
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
psp_sysfs_fini(adev);
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/amdgpu: remove redundant NULL check
@ 2022-11-23 7:44 ` zys.zljxml
0 siblings, 0 replies; 4+ messages in thread
From: zys.zljxml @ 2022-11-23 7:44 UTC (permalink / raw)
To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
Cc: Yushan Zhou, dri-devel, amd-gfx, linux-kernel
From: Yushan Zhou <katrinzhou@tencent.com>
release_firmware() checks whether firmware pointer is NULL.
Remove the redundant NULL check in psp_sw_fini().
Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++--------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index effa7df3ddbf..77b966ab5439 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -484,26 +484,22 @@ static int psp_sw_fini(void *handle)
struct psp_gfx_cmd_resp *cmd = psp->cmd;
psp_memory_training_fini(psp);
- if (psp->sos_fw) {
- release_firmware(psp->sos_fw);
- psp->sos_fw = NULL;
- }
- if (psp->asd_fw) {
- release_firmware(psp->asd_fw);
- psp->asd_fw = NULL;
- }
- if (psp->ta_fw) {
- release_firmware(psp->ta_fw);
- psp->ta_fw = NULL;
- }
- if (psp->cap_fw) {
- release_firmware(psp->cap_fw);
- psp->cap_fw = NULL;
- }
- if (psp->toc_fw) {
- release_firmware(psp->toc_fw);
- psp->toc_fw = NULL;
- }
+
+ release_firmware(psp->sos_fw);
+ psp->sos_fw = NULL;
+
+ release_firmware(psp->asd_fw);
+ psp->asd_fw = NULL;
+
+ release_firmware(psp->ta_fw);
+ psp->ta_fw = NULL;
+
+ release_firmware(psp->cap_fw);
+ psp->cap_fw = NULL;
+
+ release_firmware(psp->toc_fw);
+ psp->toc_fw = NULL;
+
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
psp_sysfs_fini(adev);
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: remove redundant NULL check
2022-11-23 7:44 ` zys.zljxml
@ 2022-11-24 21:00 ` Luben Tuikov
-1 siblings, 0 replies; 4+ messages in thread
From: Luben Tuikov @ 2022-11-24 21:00 UTC (permalink / raw)
To: zys.zljxml, alexander.deucher, christian.koenig, Xinhui.Pan,
airlied, daniel
Cc: Yushan Zhou, dri-devel, amd-gfx, linux-kernel
Applied.
Thanks,
Luben
On 2022-11-23 02:44, zys.zljxml@gmail.com wrote:
> From: Yushan Zhou <katrinzhou@tencent.com>
>
> release_firmware() checks whether firmware pointer is NULL.
> Remove the redundant NULL check in psp_sw_fini().
>
> Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++--------------
> 1 file changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index effa7df3ddbf..77b966ab5439 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -484,26 +484,22 @@ static int psp_sw_fini(void *handle)
> struct psp_gfx_cmd_resp *cmd = psp->cmd;
>
> psp_memory_training_fini(psp);
> - if (psp->sos_fw) {
> - release_firmware(psp->sos_fw);
> - psp->sos_fw = NULL;
> - }
> - if (psp->asd_fw) {
> - release_firmware(psp->asd_fw);
> - psp->asd_fw = NULL;
> - }
> - if (psp->ta_fw) {
> - release_firmware(psp->ta_fw);
> - psp->ta_fw = NULL;
> - }
> - if (psp->cap_fw) {
> - release_firmware(psp->cap_fw);
> - psp->cap_fw = NULL;
> - }
> - if (psp->toc_fw) {
> - release_firmware(psp->toc_fw);
> - psp->toc_fw = NULL;
> - }
> +
> + release_firmware(psp->sos_fw);
> + psp->sos_fw = NULL;
> +
> + release_firmware(psp->asd_fw);
> + psp->asd_fw = NULL;
> +
> + release_firmware(psp->ta_fw);
> + psp->ta_fw = NULL;
> +
> + release_firmware(psp->cap_fw);
> + psp->cap_fw = NULL;
> +
> + release_firmware(psp->toc_fw);
> + psp->toc_fw = NULL;
> +
> if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
> adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
> psp_sysfs_fini(adev);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: remove redundant NULL check
@ 2022-11-24 21:00 ` Luben Tuikov
0 siblings, 0 replies; 4+ messages in thread
From: Luben Tuikov @ 2022-11-24 21:00 UTC (permalink / raw)
To: zys.zljxml, alexander.deucher, christian.koenig, Xinhui.Pan,
airlied, daniel
Cc: amd-gfx, Yushan Zhou, dri-devel, linux-kernel
Applied.
Thanks,
Luben
On 2022-11-23 02:44, zys.zljxml@gmail.com wrote:
> From: Yushan Zhou <katrinzhou@tencent.com>
>
> release_firmware() checks whether firmware pointer is NULL.
> Remove the redundant NULL check in psp_sw_fini().
>
> Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++--------------
> 1 file changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index effa7df3ddbf..77b966ab5439 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -484,26 +484,22 @@ static int psp_sw_fini(void *handle)
> struct psp_gfx_cmd_resp *cmd = psp->cmd;
>
> psp_memory_training_fini(psp);
> - if (psp->sos_fw) {
> - release_firmware(psp->sos_fw);
> - psp->sos_fw = NULL;
> - }
> - if (psp->asd_fw) {
> - release_firmware(psp->asd_fw);
> - psp->asd_fw = NULL;
> - }
> - if (psp->ta_fw) {
> - release_firmware(psp->ta_fw);
> - psp->ta_fw = NULL;
> - }
> - if (psp->cap_fw) {
> - release_firmware(psp->cap_fw);
> - psp->cap_fw = NULL;
> - }
> - if (psp->toc_fw) {
> - release_firmware(psp->toc_fw);
> - psp->toc_fw = NULL;
> - }
> +
> + release_firmware(psp->sos_fw);
> + psp->sos_fw = NULL;
> +
> + release_firmware(psp->asd_fw);
> + psp->asd_fw = NULL;
> +
> + release_firmware(psp->ta_fw);
> + psp->ta_fw = NULL;
> +
> + release_firmware(psp->cap_fw);
> + psp->cap_fw = NULL;
> +
> + release_firmware(psp->toc_fw);
> + psp->toc_fw = NULL;
> +
> if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
> adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
> psp_sysfs_fini(adev);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-24 21:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 7:44 [PATCH] drm/amdgpu: remove redundant NULL check zys.zljxml
2022-11-23 7:44 ` zys.zljxml
2022-11-24 21:00 ` Luben Tuikov
2022-11-24 21:00 ` Luben Tuikov
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.