linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/zswap: Fix passing zero to 'PTR_ERR' warning
@ 2020-10-31  5:56 YueHaibing
  2020-11-02 10:21 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2020-10-31  5:56 UTC (permalink / raw)
  To: sjenning, ddstreet, vitaly.wool, akpm; +Cc: linux-mm, linux-kernel, YueHaibing

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 <yuehaibing@huawei.com>
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index 1eced701b3bd..55a2f72557a8 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -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;
-- 
2.17.1



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

* Re: [PATCH] mm/zswap: Fix passing zero to 'PTR_ERR' warning
  2020-10-31  5:56 [PATCH] mm/zswap: Fix passing zero to 'PTR_ERR' warning YueHaibing
@ 2020-11-02 10:21 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2020-11-02 10:21 UTC (permalink / raw)
  To: YueHaibing, sjenning, ddstreet, vitaly.wool, akpm; +Cc: linux-mm, linux-kernel

On 31.10.20 06:56, YueHaibing wrote:
> 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 <yuehaibing@huawei.com>
> ---
>   mm/zswap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 1eced701b3bd..55a2f72557a8 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -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 <david@redhat.com>

-- 
Thanks,

David / dhildenb



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

end of thread, other threads:[~2020-11-02 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31  5:56 [PATCH] mm/zswap: Fix passing zero to 'PTR_ERR' warning YueHaibing
2020-11-02 10:21 ` David Hildenbrand

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).