public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH v1 1/1] mtd: mtdpart: Do not supply NULL to printf()
Date: Thu, 13 Mar 2025 11:09:24 +0200	[thread overview]
Message-ID: <Z9KgxKocER3R1aPN@smile.fi.intel.com> (raw)
In-Reply-To: <e6616c70-7579-6114-95b0-3c4a94f98aa0@huawei.com>

On Thu, Mar 13, 2025 at 09:24:21AM +0800, Zhihao Cheng wrote:
> 在 2025/3/13 4:16, Andy Shevchenko 写道:
> > Compiler is not happy about NULL being supplied as printf() parameter:
> 
> printf -> printk? The title has the same issue.
> > 
> > drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
> > 
> > Replace that with "(null)" to fix compilation error.

> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

Thank you!

But I think my approach is a hack, the best is to move this message to the
after the follow up conditional and drop that ternary completely as we have
already another debug message before that. So, the parser == NULL can be
deducted from the appearance of the one and not the other one.

I'll send a v2.

> >   			if (!parser && !request_module("%s", *types))
> >   				parser = mtd_part_parser_get(*types);
> >   			pr_debug("%s: got parser %s\n", master->name,
> > -				parser ? parser->name : NULL);
> > +				parser ? parser->name : "(null)");
> >   			if (!parser)
> >   				continue;

(move it here)

> >   			ret = mtd_part_do_parse(parser, master, &pparts, data);

-- 
With Best Regards,
Andy Shevchenko



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2025-03-13  9:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 20:16 [PATCH v1 1/1] mtd: mtdpart: Do not supply NULL to printf() Andy Shevchenko
2025-03-13  1:24 ` Zhihao Cheng
2025-03-13  9:09   ` Andy Shevchenko [this message]
2025-03-13 10:54     ` Zhihao Cheng
2025-03-13 12:10       ` Andy Shevchenko

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=Z9KgxKocER3R1aPN@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=chengzhihao1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /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