mm/zswap: Fix passing zero to 'PTR_ERR' warning
Subsystems (2)
PATCH 1/1 mm/zswap: Fix passing zero to 'PTR_ERR' warning
Fix smatch warning:
mm/zswap.c:425 zswap_cpu_comp_prepare() warn: passing zero to 'PTR_ERR'
crypto_alloc_comp() never return NULL, use IS_ERR
instead of IS_ERR_OR_NULL to fix this.
Fixes f1c54846ee45 ("zswap: dynamic pool creation")
Signed-off-by YueHaibing <[email protected]>
--- mm/zswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
@@ -421,7 +421,7 @@ static int zswap_cpu_comp_prepare(unsigned int cpu, struct hlist_node *node)return 0 ; tfm =crypto_alloc_comp (pool->tfm_name,0 ,0 ); -if (IS_ERR_OR_NULL (tfm)) { +if (IS_ERR (tfm)) {pr_err ("could not alloc crypto comp %s : %ld\n" , pool->tfm_name,PTR_ERR (tfm));return -ENOMEM ;
Signature · 1 line
2.17.1
Quoted 19 lines · YueHaibing
Fix smatch warning:
mm/zswap.c:425zswap_cpu_comp_prepare()warn: passing zero to 'PTR_ERR'
crypto_alloc_comp()never return NULL, useIS_ERR
instead ofIS_ERR_OR_NULLto fix this.Fixes f1c54846ee45 ("zswap: dynamic pool creation")Signed-off-by YueHaibing <[email protected]>--- mm/zswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/zswap.c +0
-0
mm/zswap.c static int zswap_cpu_comp_prepare(unsigned int cpu, struct hlist_node *node) · line 427
Quoted 8 lines
mm/zswap.c +1
-1@@ -421,7 +421,7 @@ static int zswap_cpu_comp_prepare(unsigned int cpu, struct hlist_node *node)return 0 ; tfm =crypto_alloc_comp (pool->tfm_name,0 ,0 ); -if (IS_ERR_OR_NULL (tfm)) { +if (IS_ERR (tfm)) {pr_err ("could not alloc crypto comp %s : %ld\n" , pool->tfm_name,PTR_ERR (tfm));return -ENOMEM ;
Reviewed-by David Hildenbrand <[email protected]>
Signature · 3 lines
Thanks, David / dhildenb