kernel: params: Remove unnecessary ‘0’ values from err

Message ID 20230711194331.4361-1-zeming@nfschina.com
State New
Headers
Series kernel: params: Remove unnecessary ‘0’ values from err |

Commit Message

Li zeming July 11, 2023, 7:43 p.m. UTC
  err is assigned first, so it does not need to initialize the assignment.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 kernel/params.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Randy Dunlap July 10, 2023, 3:33 a.m. UTC | #1
On 7/11/23 12:43, Li zeming wrote:
> err is assigned first, so it does not need to initialize the assignment.
> 
> Signed-off-by: Li zeming <zeming@nfschina.com>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  kernel/params.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/params.c b/kernel/params.c
> index 6a7548979aa9..f8837a5f2c3e 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -331,7 +331,7 @@ EXPORT_SYMBOL(param_ops_bool);
>  
>  int param_set_bool_enable_only(const char *val, const struct kernel_param *kp)
>  {
> -	int err = 0;
> +	int err;
>  	bool new_value;
>  	bool orig_value = *(bool *)kp->arg;
>  	struct kernel_param dummy_kp = *kp;
  
Luis Chamberlain July 10, 2023, 7:47 p.m. UTC | #2
On Sun, Jul 09, 2023 at 08:33:28PM -0700, Randy Dunlap wrote:
> 
> 
> On 7/11/23 12:43, Li zeming wrote:
> > err is assigned first, so it does not need to initialize the assignment.
> > 
> > Signed-off-by: Li zeming <zeming@nfschina.com>
> 
> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks, I've taken this through the modules tree and pushed out.

  Luis
  

Patch

diff --git a/kernel/params.c b/kernel/params.c
index 6a7548979aa9..f8837a5f2c3e 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -331,7 +331,7 @@  EXPORT_SYMBOL(param_ops_bool);
 
 int param_set_bool_enable_only(const char *val, const struct kernel_param *kp)
 {
-	int err = 0;
+	int err;
 	bool new_value;
 	bool orig_value = *(bool *)kp->arg;
 	struct kernel_param dummy_kp = *kp;