public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org,
	Evgeniy Dushistov <dushistov@mail.ru>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] fs/ufs/super.c: remove unnecessary casting
Date: Sun, 28 Dec 2014 08:54:28 -0800	[thread overview]
Message-ID: <1419785668.20894.13.camel@perches.com> (raw)
In-Reply-To: <1419780509-4582-1-git-send-email-fabf@skynet.be>

On Sun, 2014-12-28 at 16:28 +0100, Fabian Frederick wrote:
> Fix the following coccinelle warning:
> fs/ufs/super.c:1418:7-28: WARNING: casting value returned by memory
> allocation function to (struct ufs_inode_info *) is useless.
[]
> diff --git a/fs/ufs/super.c b/fs/ufs/super.c
[]
> @@ -1414,8 +1414,8 @@ static struct kmem_cache * ufs_inode_cachep;
>  
>  static struct inode *ufs_alloc_inode(struct super_block *sb)
>  {
> -	struct ufs_inode_info *ei;
> -	ei = (struct ufs_inode_info *)kmem_cache_alloc(ufs_inode_cachep, GFP_NOFS);
> +	struct ufs_inode_info *ei = kmem_cache_alloc(ufs_inode_cachep,
> +						     GFP_NOFS);

If you insist on the blank line after declaration style,
perhaps it's better to separate the declaration from
the alloc so the alloc is on a single line like:

static struct inode *ufs_alloc_inode(struct super_block *sb)
{
	struct ufs_inode_info *ei;

	ei = kmem_cache_alloc(ufs_inode_cachep, GFP_NOFS);
	if (!ei)
		return NULL;

	ei->vfs_inode.i_version = 1;
	etc...



      parent reply	other threads:[~2014-12-28 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-28 15:28 [PATCH 1/1] fs/ufs/super.c: remove unnecessary casting Fabian Frederick
2014-12-28 15:33 ` Al Viro
2014-12-28 16:45   ` Joe Perches
2014-12-28 18:21     ` Al Viro
2014-12-31  8:46       ` Fabian Frederick
2014-12-28 16:54 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419785668.20894.13.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=dushistov@mail.ru \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox