From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/3] restart: give all restart handlers a descriptive name
Date: Wed, 3 Jun 2020 09:12:58 +0200 [thread overview]
Message-ID: <20200603071258.GR11869@pengutronix.de> (raw)
In-Reply-To: <20200602075757.4734-2-a.fatoum@pengutronix.de>
On Tue, Jun 02, 2020 at 09:57:56AM +0200, Ahmad Fatoum wrote:
> diff --git a/common/restart.c b/common/restart.c
> index dd15c8d5c362..66131c262938 100644
> --- a/common/restart.c
> +++ b/common/restart.c
> @@ -47,6 +47,7 @@ int restart_handler_register(struct restart_handler *rst)
>
> /**
> * restart_handler_register_fn() - register a handler function
> + * @name: restart method name or NULL if name should be auto-generated
> * @restart_fn: The restart function
> *
> * convenience wrapper for restart_handler_register() to register a handler
> @@ -54,13 +55,15 @@ int restart_handler_register(struct restart_handler *rst)
> *
> * return: 0 for success or negative error code
> */
> -int restart_handler_register_fn(void (*restart_fn)(struct restart_handler *))
> +int restart_handler_register_fn(const char *name,
> + void (*restart_fn)(struct restart_handler *))
> {
> struct restart_handler *rst;
> int ret;
>
> rst = xzalloc(sizeof(*rst));
>
> + rst->name = name;
Please allocate the name in case someone passes an array from the stack
here.
Regards,
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-06-03 7:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 7:57 [PATCH 1/3] common: restart: number unnamed restart handlers Ahmad Fatoum
2020-06-02 7:57 ` [PATCH 2/3] restart: give all restart handlers a descriptive name Ahmad Fatoum
2020-06-03 7:12 ` Sascha Hauer [this message]
2020-09-15 12:05 ` [PATCH] fixup! " Ahmad Fatoum
2020-06-02 7:57 ` [PATCH 3/3] commands: reset: allow specifying reset by name Ahmad Fatoum
2020-06-03 7:11 ` [PATCH 1/3] common: restart: number unnamed restart handlers Sascha Hauer
2020-06-03 13:32 ` Ahmad Fatoum
2020-06-08 5:20 ` Sascha Hauer
2020-09-15 8:48 ` Ahmad Fatoum
2020-09-15 12:32 ` Sascha Hauer
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=20200603071258.GR11869@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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