public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Borislav Petkov <bp@alien8.de>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-usb@vger.kernel.org
Subject: Re: [PATCH v0 16/42] USB: Check notifier registration return value
Date: Mon, 8 Nov 2021 09:05:53 -0500	[thread overview]
Message-ID: <20211108140553.GA1666297@rowland.harvard.edu> (raw)
In-Reply-To: <20211108101157.15189-17-bp@alien8.de>

On Mon, Nov 08, 2021 at 11:11:31AM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Avoid homegrown notifier registration checks.

This is a rather misleading description.  The patch does exactly the 
opposite: It _adds_ a homegrown notifier registration check.  (Homegrown 
in the sense that the check is made by the individual caller rather than 
being centralized in the routine being called.)

Alan Stern

> No functional changes.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: linux-usb@vger.kernel.org
> ---
>  drivers/usb/core/notify.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c
> index e6143663778f..80d1bfa61887 100644
> --- a/drivers/usb/core/notify.c
> +++ b/drivers/usb/core/notify.c
> @@ -28,7 +28,8 @@ static BLOCKING_NOTIFIER_HEAD(usb_notifier_list);
>   */
>  void usb_register_notify(struct notifier_block *nb)
>  {
> -	blocking_notifier_chain_register(&usb_notifier_list, nb);
> +	if (blocking_notifier_chain_register(&usb_notifier_list, nb))
> +		pr_warn("USB change notifier already registered\n");
>  }
>  EXPORT_SYMBOL_GPL(usb_register_notify);
>  
> -- 
> 2.29.2
> 

  reply	other threads:[~2021-11-08 14:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211108101157.15189-1-bp@alien8.de>
2021-11-08 10:11 ` [PATCH v0 16/42] USB: Check notifier registration return value Borislav Petkov
2021-11-08 14:05   ` Alan Stern [this message]
2021-11-08 14:09     ` Borislav Petkov
2021-11-08 10:11 ` [PATCH v0 42/42] notifier: Return an error when callback is already registered Borislav Petkov
2021-11-08 14:07   ` Geert Uytterhoeven
2021-11-08 14:21     ` Borislav Petkov
2021-11-08 15:25       ` Geert Uytterhoeven
2021-11-08 15:58         ` Borislav Petkov
2021-11-08 16:12           ` Geert Uytterhoeven
2021-11-08 16:21             ` Borislav Petkov
2021-11-08 20:59               ` Alan Stern
2021-11-08 21:18                 ` Borislav Petkov
2021-11-08 10:19 ` [PATCH v0 00/42] notifiers: " Borislav Petkov
2021-11-08 14:17   ` Alan Stern
2021-11-08 14:24     ` Borislav Petkov
2021-11-08 14:35       ` Borislav Petkov
2021-11-08 16:23         ` Steven Rostedt
2021-11-08 16:29           ` Borislav Petkov

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=20211108140553.GA1666297@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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