mtd: mtdpart: Do not supply NULL to printf()
PATCH v2 1/1 mtd: mtdpart: Do not supply NULL to printf()
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.
---
v2: changed approach to remove that ternary completely, seems less hackish
drivers/mtd/mtdpart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/mtdpart.c +1 -2
@@ -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);
Signature · 1 line
2.47.2
Quoted 7 lines · 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.
Quoted 7 lines
Signed-off-by Andy Shevchenko <[email protected]>---
v2: changed approach to remove that ternary completely, seems less hackish
drivers/mtd/mtdpart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 18 lines
drivers/mtd/mtdpart.c +1
-2@@ -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);
Quoted 9 lines · Zhihao Cheng
Quoted 6 lines · 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 <[email protected]>
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · 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.
[...]
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