2020-08-15 22:01:47

by Oded Gabbay

[permalink] [raw]
Subject: [PATCH 3/9] habanalabs: eliminate redundant else condition

If both parts of if-else are goto statements, we can remove the else and
put the else goto statement after the if statement.

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Oded Gabbay <[email protected]>
---
drivers/misc/habanalabs/common/command_submission.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 2b40aa85bec9..58327cdb6a2c 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -686,8 +686,8 @@ static int cs_ioctl_default(struct hl_fpriv *hpriv, void __user *chunks,
rc = -ENOMEM;
if (is_kernel_allocated_cb)
goto release_cb;
- else
- goto free_cs_object;
+
+ goto free_cs_object;
}

job->id = i + 1;
--
2.17.1


2020-08-16 15:26:10

by Tomer Tayar

[permalink] [raw]
Subject: RE: [PATCH 3/9] habanalabs: eliminate redundant else condition

On Sat, Aug 15, 2020 at 21:00 Oded Gabbay <[email protected]> wrote:
> If both parts of if-else are goto statements, we can remove the else and
> put the else goto statement after the if statement.
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Oded Gabbay <[email protected]>

Reviewed-by: Tomer Tayar <[email protected]>