From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CC32C433ED for ; Fri, 21 May 2021 14:06:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3616E613C8 for ; Fri, 21 May 2021 14:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236281AbhEUOIT (ORCPT ); Fri, 21 May 2021 10:08:19 -0400 Received: from mail.skyhub.de ([5.9.137.197]:49434 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232170AbhEUOIL (ORCPT ); Fri, 21 May 2021 10:08:11 -0400 Received: from zn.tnic (p200300ec2f0ea400b1711cbbd717391b.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:a400:b171:1cbb:d717:391b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 92DBB1EC05C4; Fri, 21 May 2021 16:06:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1621606007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=K8BcFfxWlskEBAltLRBqJWeBSRtx5p+D0WcH9Jk0FVo=; b=E2c2lgwKuDLGZiRFZ+3E4tapaz56BfvTrVzCzkSgi6rotAZLDtJ16k1VUDhBMwEcfiwltt H71Exp944PmIOdg5RZjYbxXC1CUzzUNi817/0lyhbxhjLCvrQA4yz6b0iok6soLIskah7Q Yx1dD36vAHJoHidc8HdoZjY9//FJp/A= Date: Fri, 21 May 2021 16:06:42 +0200 From: Borislav Petkov To: Peter Zijlstra Cc: X86 ML , LKML Subject: Re: [RFC PATCH] notifier: Return non-null when callback already registered Message-ID: References: <20210520202033.23851-1-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 01:11:42PM +0200, Peter Zijlstra wrote: > > @@ -25,7 +25,7 @@ static int notifier_chain_register(struct notifier_block **nl, > > while ((*nl) != NULL) { > > if (unlikely((*nl) == n)) { > > WARN(1, "double register detected"); > > That should give a big clue^ Yah, the big cluebat... Was wondering whether to remove it, actually. But then I'd need to audit all users whether they handle retval properly. Sounds like a kernelnewbies project to me... > > - return 0; > > + return 1; > > How about -EBUSY here? Yah, anthing but 0. But if we're gonna return -E things, -EEXIST looks like an even better fit to me... Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette