Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1449232
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] zsmalloc: Delete an unnecessary check before the function call "iput" |
| Date | Mon, 25 Jul 2016 03:00:02 +0200 |
| Message-ID | <rYCps-6fV-3@gated-at.bofh.it> (permalink) |
| References | <mSsDN-4wa-51@gated-at.bofh.it> <mSsDN-4wa-53@gated-at.bofh.it> <mSsDN-4wa-55@gated-at.bofh.it> <mSsDN-4wa-57@gated-at.bofh.it> <mSsDN-4wa-59@gated-at.bofh.it> <mSsDN-4wa-61@gated-at.bofh.it> <mSsDN-4wa-63@gated-at.bofh.it> <mSsDN-4wa-65@gated-at.bofh.it> <mSsDN-4wa-33@gated-at.bofh.it> <rXN3A-Qn-23@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3pzuGtkPaFX+664p8KrVPveuwkeyiBYgvBbdNl1fAoM=; b=F7+NxYyfeUuy6NpJlLLsuGRDm7pN87x01jCJdHztDmWzHdMLK1XctYPTDbzU5OGRdU lepthdOLC4Yv8uOAHNnmvmEeyEjCNtA0imDFvz2p0X5E+T40efCH3UD0mqZtHr9W9xRd W9pFgmMI150ztDLQywk9vQ9ZpeZOmdKivc1bF+id8seZfw51SdSDStC7MFIEihoN1LA5 n473/C0daxPvt1bMUtqYzL4sMX/3ktxd5wJWffLneLADjtrMqIMSDysZWi24kEm7pLoa skvyP2s48Wx4lWnPC0td7eBXZtp364ILAufswa9HIfd0z/5bbg9DXrtrfWbcQsZb/I6Z GMIA== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3pzuGtkPaFX+664p8KrVPveuwkeyiBYgvBbdNl1fAoM=; b=d+GRoYQUzBr2edMBmBx1Pg4piRw0kXzknRGzltXeXdPRbTAXb+yHtLns4WW9IQRlIw wrCyzKh1BOjkZnIbh6OeUXNb6f/Zf/noR2DrQ/ML04Zr88Vxx8e2awC9QLJ3BsE36Sr2 ZT+iBPYuHNoDbVHz2idUEX9zfwSoZ2FhMQB/paoHMoIN0ckf1jmSaupNlm4OVe/uVPG0 Nht/JP3+ypDM6WtNsebTvbWl5RvgMPlqIFY2V/zIQ3fJSDg3dzsGBRpUq11/3plGXRRr UWE9Umt2rAxc3mvR9jZgKzljgYf37lzl03iboKtpchHccArOV7VWbO3o1MThk+PaZyJa hM9w== |
| X-Gm-Message-State | AEkoouuaEnlvv2TU3zv4cCeE3HOdTMLTv7h+RZ046masq3RR/C/eNWsbsoLazqPEGywrKw== |
| X-Received | by 10.66.26.105 with SMTP id k9mr25154354pag.103.1469407795015; Sun, 24 Jul 2016 17:49:55 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.6.2 (2016-07-01) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 72 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-mm@kvack.org, Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>, Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>, LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>, Andrew Morton <akpm@linux-foundation.org> |
| X-Original-Date | Mon, 25 Jul 2016 09:49:56 +0900 |
| X-Original-Message-ID | <20160725004956.GA430@swordfish> |
| X-Original-References | <530C5E18.1020800@users.sourceforge.net> <alpine.DEB.2.10.1402251014170.2080@hadrien> <530CD2C4.4050903@users.sourceforge.net> <alpine.DEB.2.10.1402251840450.7035@hadrien> <530CF8FF.8080600@users.sourceforge.net> <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6> <530DD06F.4090703@users.sourceforge.net> <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6> <5317A59D.4@users.sourceforge.net> <559cf499-4a01-25f9-c87f-24d906626a57@users.sourceforge.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1449232 |
Show key headers only | View raw
On (07/22/16 20:02), SF Markus Elfring wrote:
> The iput() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
there is no issue; the change is just cosmetic.
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
alloc_anon_inode() returns ERR_PTR, so I'd probably rather
change iput() to do IS_ERR_OR_NULL instead of !NULL.
inode = alloc_anon_inode();
if (IS_ERR(inode)) {
inode = NULL;
^^^^^^^^^^^^^
}
...
iput(inode);
this NULL assignment on error path is a bit fragile.
IOW, something like this
---
diff --git a/fs/inode.c b/fs/inode.c
index 559a9da..f1b7bd2 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1497,7 +1497,7 @@ static void iput_final(struct inode *inode)
*/
void iput(struct inode *inode)
{
- if (!inode)
+ if (IS_ERR_OR_NULL(inode))
return;
BUG_ON(inode->i_state & I_CLEAR);
retry:
---
-ss
> ---
> mm/zsmalloc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 5e5237c..7b5fd2b 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -2181,8 +2181,7 @@ static int zs_register_migration(struct zs_pool *pool)
> static void zs_unregister_migration(struct zs_pool *pool)
> {
> flush_work(&pool->free_work);
> - if (pool->inode)
> - iput(pool->inode);
> + iput(pool->inode);
> }
>
> /*
> --
> 2.9.2
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] zsmalloc: Delete an unnecessary check before the function call "iput" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-22 20:10 +0200 Re: [PATCH] zsmalloc: Delete an unnecessary check before the function call "iput" Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-07-25 03:00 +0200 Re: [PATCH] zsmalloc: Delete an unnecessary check before the function call "iput" Minchan Kim <minchan@kernel.org> - 2016-07-25 11:10 +0200
csiph-web