# Re: \[PATCH v1 1/1\] treewide: Align match\_string() with sysfs\_match\_string()

- From: Zhihao Cheng \<chengzhihao1@huawei.com\>
- Date: 2024-06-04 01:38:17 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2024/06/2624465
- Thread: https://ratatoskr.run/linuxppc-dev/2024/06/2624286/t.md

```text
在 2024/6/2 23:57, Andy Shevchenko 写道:
> Make two APIs look similar. Hence convert match_string() to be
> a 2-argument macro. In order to avoid unneeded churn, convert
> all users as well. There is no functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> Compile tested with `make allyesconfig` and `make allmodconfig`
> on x86_64, arm, aarch64, powerpc64 (8 builds total).
>

[...]
> diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c
> index a4a0158f712d..fc0da18bfa65 100644
> --- a/fs/ubifs/auth.c
> +++ b/fs/ubifs/auth.c
> @@ -264,13 +264,13 @@ int ubifs_init_authentication(struct ubifs_info *c)
>   		return -EINVAL;
>   	}
>   
> -	c->auth_hash_algo = match_string(hash_algo_name, HASH_ALGO__LAST,
> -					 c->auth_hash_name);
> -	if ((int)c->auth_hash_algo < 0) {
> +	err = __match_string(hash_algo_name, HASH_ALGO__LAST, c->auth_hash_name);
> +	if (err < 0) {
>   		ubifs_err(c, "Unknown hash algo %s specified",
>   			  c->auth_hash_name);
> -		return -EINVAL;
> +		return err;
>   	}
> +	c->auth_hash_algo = err;
>   
>   	snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)",
>   		 c->auth_hash_name);

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>  # fs/ubifs
```
