* [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf()
@ 2025-03-13 9:15 Andy Shevchenko
2025-03-13 13:09 ` Zhihao Cheng
2025-03-18 16:18 ` Miquel Raynal
0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-13 9:15 UTC (permalink / raw)
To: Andy Shevchenko, linux-mtd, linux-kernel
Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
GCC compiler is not happy about NULL being supplied as printf() parameter:
drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
Move the code after the parser test for NULL, and drop the ternary completely.
The user can deduct this since when it's not NULL two messages will be printed.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: changed approach to remove that ternary completely, seems less hackish
drivers/mtd/mtdpart.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 6811a714349d..994e8c51e674 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -690,10 +690,9 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
parser = mtd_part_parser_get(*types);
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);
if (!parser)
continue;
+ pr_debug("%s: got parser %s\n", master->name, parser->name);
ret = mtd_part_do_parse(parser, master, &pparts, data);
if (ret <= 0)
mtd_part_parser_put(parser);
--
2.47.2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf()
2025-03-13 9:15 [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf() Andy Shevchenko
@ 2025-03-13 13:09 ` Zhihao Cheng
2025-03-13 13:56 ` Andy Shevchenko
2025-03-18 16:18 ` Miquel Raynal
1 sibling, 1 reply; 4+ messages in thread
From: Zhihao Cheng @ 2025-03-13 13:09 UTC (permalink / raw)
To: Andy Shevchenko, linux-mtd, linux-kernel
Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
在 2025/3/13 17:15, Andy Shevchenko 写道:
> GCC compiler is not happy about NULL being supplied as printf() parameter:
>
> drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
>
> Move the code after the parser test for NULL, and drop the ternary completely.
> The user can deduct this since when it's not NULL two messages will be printed.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> v2: changed approach to remove that ternary completely, seems less hackish
>
> drivers/mtd/mtdpart.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 6811a714349d..994e8c51e674 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -690,10 +690,9 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
> parser = mtd_part_parser_get(*types);
> 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);
> if (!parser)
> continue;
> + pr_debug("%s: got parser %s\n", master->name, parser->name);
> ret = mtd_part_do_parse(parser, master, &pparts, data);
> if (ret <= 0)
> mtd_part_parser_put(parser);
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf()
2025-03-13 13:09 ` Zhihao Cheng
@ 2025-03-13 13:56 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-13 13:56 UTC (permalink / raw)
To: Zhihao Cheng
Cc: linux-mtd, linux-kernel, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
On Thu, Mar 13, 2025 at 09:09:09PM +0800, Zhihao Cheng wrote:
> 在 2025/3/13 17:15, Andy Shevchenko 写道:
> > GCC compiler is not happy about NULL being supplied as printf() parameter:
> >
> > drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
> >
> > Move the code after the parser test for NULL, and drop the ternary completely.
> > The user can deduct this since when it's not NULL two messages will be printed.
> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Thank you!
--
With Best Regards,
Andy Shevchenko
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf()
2025-03-13 9:15 [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf() Andy Shevchenko
2025-03-13 13:09 ` Zhihao Cheng
@ 2025-03-18 16:18 ` Miquel Raynal
1 sibling, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2025-03-18 16:18 UTC (permalink / raw)
To: linux-mtd, linux-kernel, Andy Shevchenko
Cc: Richard Weinberger, Vignesh Raghavendra
On Thu, 13 Mar 2025 11:15:53 +0200, Andy Shevchenko wrote:
> GCC compiler is not happy about NULL being supplied as printf() parameter:
>
> drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
>
> Move the code after the parser test for NULL, and drop the ternary completely.
> The user can deduct this since when it's not NULL two messages will be printed.
>
> [...]
Applied to mtd/next, thanks!
[1/1] mtd: mtdpart: Do not supply NULL to printf()
commit: 6bc9f42739889eaaaa47b90f48e4ef8323efa3ea
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-18 16:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 9:15 [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf() Andy Shevchenko
2025-03-13 13:09 ` Zhihao Cheng
2025-03-13 13:56 ` Andy Shevchenko
2025-03-18 16:18 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox