linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/sgx: simplify the return expression of sgx_drv_init()
@ 2022-05-05  2:16 cgel.zte
  2022-05-05 17:31 ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: cgel.zte @ 2022-05-05  2:16 UTC (permalink / raw)
  To: jarkko
  Cc: dave.hansen, tglx, linux-sgx, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Simplify the return expression.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 arch/x86/kernel/cpu/sgx/driver.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/sgx/driver.c b/arch/x86/kernel/cpu/sgx/driver.c
index aa9b8b868867..dffb271f4edb 100644
--- a/arch/x86/kernel/cpu/sgx/driver.c
+++ b/arch/x86/kernel/cpu/sgx/driver.c
@@ -148,7 +148,6 @@ int __init sgx_drv_init(void)
 	unsigned int eax, ebx, ecx, edx;
 	u64 attr_mask;
 	u64 xfrm_mask;
-	int ret;
 
 	if (!cpu_feature_enabled(X86_FEATURE_SGX_LC))
 		return -ENODEV;
@@ -172,9 +171,5 @@ int __init sgx_drv_init(void)
 		sgx_xfrm_reserved_mask = ~xfrm_mask;
 	}
 
-	ret = misc_register(&sgx_dev_enclave);
-	if (ret)
-		return ret;
-
-	return 0;
+	return misc_register(&sgx_dev_enclave);
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/sgx: simplify the return expression of sgx_drv_init()
  2022-05-05  2:16 [PATCH] x86/sgx: simplify the return expression of sgx_drv_init() cgel.zte
@ 2022-05-05 17:31 ` Dave Hansen
  2022-05-06 22:30   ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2022-05-05 17:31 UTC (permalink / raw)
  To: cgel.zte, jarkko
  Cc: dave.hansen, tglx, linux-sgx, linux-kernel, Minghao Chi, Zeal Robot

On 5/4/22 19:16, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Simplify the return expression.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Folks, I'd really encourage you to spend your time elsewhere.  These
"cleanup" or "simplify" patches as a whole have high rates of bugs.  I
don't trust them.  Plus, they don't really make the code easier to
understand.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/sgx: simplify the return expression of sgx_drv_init()
  2022-05-05 17:31 ` Dave Hansen
@ 2022-05-06 22:30   ` Jarkko Sakkinen
  0 siblings, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2022-05-06 22:30 UTC (permalink / raw)
  To: Dave Hansen
  Cc: cgel.zte, dave.hansen, tglx, linux-sgx, linux-kernel,
	Minghao Chi, Zeal Robot

On Thu, May 05, 2022 at 10:31:41AM -0700, Dave Hansen wrote:
> On 5/4/22 19:16, cgel.zte@gmail.com wrote:
> > From: Minghao Chi <chi.minghao@zte.com.cn>
> > 
> > Simplify the return expression.
> > 
> > Reported-by: Zeal Robot <zealci@zte.com.cn>
> > Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Folks, I'd really encourage you to spend your time elsewhere.  These
> "cleanup" or "simplify" patches as a whole have high rates of bugs.  I
> don't trust them.  Plus, they don't really make the code easier to
> understand.

I agree. I get this kind of clean up in the context of doing something
to the functionality (in the same path) but it does not live by its own.

Plus, these type of patches add to the effort backporting fixes.

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-06 22:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05  2:16 [PATCH] x86/sgx: simplify the return expression of sgx_drv_init() cgel.zte
2022-05-05 17:31 ` Dave Hansen
2022-05-06 22:30   ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).