public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	dwmw2@infradead.org, maximlevitsky@gmail.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] mtd: nandsim: Fix kasprintf() usage
Date: Tue, 16 Jun 2015 21:42:41 -0700	[thread overview]
Message-ID: <1434516161.2689.67.camel@perches.com> (raw)
In-Reply-To: <20150617020707.GD4917@ld-irv-0074>

On Tue, 2015-06-16 at 19:07 -0700, Brian Norris wrote:
> On Mon, Jun 01, 2015 at 11:10:50PM +0200, Richard Weinberger wrote:
> > kasprintf() used in get_partition_name() does a dynamic
> > memory allocation and can fail. We have to handle that case.
[]
> > diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
[]
> > @@ -743,6 +743,11 @@ static int init_nandsim(struct mtd_info *mtd)
> >  			goto error;
> >  		}
> >  		ns->partitions[i].name   = get_partition_name(i);
> > +		if (!ns->partitions[i].name) {
> > +			NS_ERR("unable to allocate memory.\n");
> 
> Probably don't really need the allocation failure messages. But this
> matches the current style, so we can just rip the messages out at
> another time.

Maybe that other time can use the more typical
pr_<level> mechanisms instead of NS_<LEVEL> too.

As far as I can tell, the only thing that the
NS_<LEVEL> macros do is prefix "error: " and
"warning: " to the output.

"[nandsim] " could be added via pr_fmt and it
could be changed to "nandsim: " for commonality
with the majority of the kernel logging.



  reply	other threads:[~2015-06-17  4:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 21:10 Some fixes for MTD drivers Richard Weinberger
2015-06-01 21:10 ` [PATCH 1/6] mtd: r852: Fix device_create_file() usage Richard Weinberger
2015-06-17  2:07   ` Brian Norris
2015-06-01 21:10 ` [PATCH 2/6] mtd: nandsim: Fix kasprintf() usage Richard Weinberger
2015-06-17  2:07   ` Brian Norris
2015-06-17  4:42     ` Joe Perches [this message]
2015-06-01 21:10 ` [PATCH 3/6] mtd: cs553x_nand: " Richard Weinberger
2015-06-01 21:10 ` [PATCH 4/6] mtd: docg3: Don't leak docg3->bbt in error path Richard Weinberger
2015-06-01 21:10 ` [PATCH 5/6] mtd: docg3: Fix kasprintf() usage Richard Weinberger
2015-06-01 21:10 ` [PATCH 6/6] mtd: docg3: Don't do ERR_PTR(0) Richard Weinberger
2015-06-17 18:41   ` Brian Norris
2015-06-23  6:27     ` Richard Weinberger
2015-06-23 20:41       ` Robert Jarzmik
2015-06-25  2:29         ` Brian Norris
2015-06-25 17:14           ` Robert Jarzmik
2015-06-26  0:23             ` Brian Norris

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=1434516161.2689.67.camel@perches.com \
    --to=joe@perches.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=maximlevitsky@gmail.com \
    --cc=richard@nod.at \
    /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