From patchwork Tue Oct 18 04:55:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13009910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3A4CC43219 for ; Tue, 18 Oct 2022 04:56:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81A258E0005; Tue, 18 Oct 2022 00:56:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C99D8E0002; Tue, 18 Oct 2022 00:56:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 691BA8E0005; Tue, 18 Oct 2022 00:56:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5A02F8E0002 for ; Tue, 18 Oct 2022 00:56:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3661E120A88 for ; Tue, 18 Oct 2022 04:56:06 +0000 (UTC) X-FDA: 80032858332.16.2B74D83 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf22.hostedemail.com (Postfix) with ESMTP id BA731C0032 for ; Tue, 18 Oct 2022 04:56:05 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id 10so12799901pli.0 for ; Mon, 17 Oct 2022 21:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5M5hW54OP3FcHBFbXUW0BvyRXPUP5sF32vTgPzuINJw=; b=OpPjLqj+j0EF5h4VtuAZp6f+eGdl/5fSvLw56hi7HO01ZV6gqL3LhfNt4tuqvbFZWL B9Zo2V1IhStyc8xGnpweJqdk5JOPtoGtNyRZvNKx+nA/GCWy7rPkstTlJfT4GGbEyOzL khin31KlV69YEer+c0KA1hT4XmJY8qBrHD7bg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5M5hW54OP3FcHBFbXUW0BvyRXPUP5sF32vTgPzuINJw=; b=HJJCgz+q+BnspksgX6LjwuQCDKm06ddct86Zak0D+16o1nYmLcUtdVe9Zj8eHsVD7e kUI3VySnIRZJb5xnOiVqzxu6xt1NL3e5oTvWkBOGX6/+J0VqCg9hI+gOEExF6uBcgbpg wUL86yaHtbTY0ZoTNZTMuLHA7lqUvR6++HM2zTzzVwd7KNhB23N4wAMY3XOJqvJWiZne bd/8U3/z4JLN1stXhJNPcG9nZfbJ+61doNKdYpYbq8Yw3KldyXRbOLWYlHKOjVarAri9 hMdrCk+mu1RtIG2UZ/7B/Ny4I3z3tprVQlVLqvBS6aM2Xwip2gmCIste+J5g6YlaPShC Jxfw== X-Gm-Message-State: ACrzQf0ReZrxBVKT0vcG3UTwYDEjxn+apM81n7s9HExLfY+HoT3/el6h xXA3v58okixHJ4NCobO7CKRCIA== X-Google-Smtp-Source: AMsMyM6MKM49SbK5pAtcJa9D193BGaOIJJk0SqOeD46rdK86Nh8j/RagnI/d8Ulw0ikvj1yWjSgb+w== X-Received: by 2002:a17:902:e5c3:b0:185:53ee:60e3 with SMTP id u3-20020a170902e5c300b0018553ee60e3mr1397002plf.71.1666068964804; Mon, 17 Oct 2022 21:56:04 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:17a9:73b0:c262:eccd]) by smtp.gmail.com with ESMTPSA id p4-20020a170902e74400b0017b69f99321sm7549220plf.219.2022.10.17.21.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 21:56:04 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCHv4 9/9] zram: Use IS_ERR_VALUE() to check for zs_malloc() errors Date: Tue, 18 Oct 2022 13:55:33 +0900 Message-Id: <20221018045533.2396670-10-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221018045533.2396670-1-senozhatsky@chromium.org> References: <20221018045533.2396670-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666068965; a=rsa-sha256; cv=none; b=Bxi9DgDYNOHuV+YKUVkkLY5uaBgT4jW3RQVCE5sGbjTW+DErXOSy+bdjNuGclalExzz0G8 BeaBfGe9rGuJMjJCOfbBQRGRzfdyZppwyDZ6AMOdOW/2gZLgsgi26o4ihEogqHqEdxH0sF o//+yWMiFCGSih0DbTIzRQ9uP47qyQg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=OpPjLqj+; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf22.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.181 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666068965; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5M5hW54OP3FcHBFbXUW0BvyRXPUP5sF32vTgPzuINJw=; b=f9DQeE66rf9dF85h9y5NMNocUWbnD8zC9tFmXaKvp/WIWRaCCsRRh5QppSQCiijREghVSF zvIKpLutdGJa+nucQ050s3xr1E5AmdHdzbv7uSOhDNypN8pa4/eOiyYFN3jPb/ubaGP/pQ APDWcbw1gyDNrfk8dlBDMgw4Pd13BMM= X-Stat-Signature: kfrndsnsopmmintnsw4zbg8hppydnmqx X-Rspamd-Queue-Id: BA731C0032 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=OpPjLqj+; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf22.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.181 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Rspamd-Server: rspam11 X-HE-Tag: 1666068965-963205 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Avoid type casts that are needed for IS_ERR() and use IS_ERR_VALUE() instead. Suggested-by: Andrew Morton Signed-off-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 6b56f6f2ce82..422e3cfd2ddc 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1506,19 +1506,19 @@ static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, * if we have a 'non-null' handle here then we are coming * from the slow path and handle has already been allocated. */ - if (IS_ERR((void *)handle)) + if (IS_ERR_VALUE(handle)) handle = zs_malloc(zram->mem_pool, comp_len, __GFP_KSWAPD_RECLAIM | __GFP_NOWARN | __GFP_HIGHMEM | __GFP_MOVABLE); - if (IS_ERR((void *)handle)) { + if (IS_ERR_VALUE(handle)) { zcomp_stream_put(zram->comps[ZRAM_PRIMARY_ZCOMP]); atomic64_inc(&zram->stats.writestall); handle = zs_malloc(zram->mem_pool, comp_len, GFP_NOIO | __GFP_HIGHMEM | __GFP_MOVABLE); - if (IS_ERR((void *)handle)) + if (IS_ERR_VALUE(handle)) return PTR_ERR((void *)handle); if (comp_len != PAGE_SIZE) @@ -1685,7 +1685,7 @@ static int zram_recompress(struct zram *zram, u32 index, struct page *page, __GFP_NOWARN | __GFP_HIGHMEM | __GFP_MOVABLE); - if (IS_ERR((void *)handle_next)) { + if (IS_ERR_VALUE(handle_next)) { zcomp_stream_put(zram->comps[ZRAM_SECONDARY_ZCOMP]); return PTR_ERR((void *)handle_next); }