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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6329C433EF for ; Mon, 8 Nov 2021 15:33:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF7BC610A8 for ; Mon, 8 Nov 2021 15:33:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EF7BC610A8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1D2841655; Mon, 8 Nov 2021 16:33:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1D2841655 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1636385630; bh=CyK50g40MDcTmqVSAT2lbzqT9Pks9maBuVBTSzuZfZ0=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bcxTbB2NnXV9gX59u6Y5U8gfeypV3c9e4fQrkajjbDTwTNhq6QgcPor9MzqH3VgOT tQjq7Q+m6jwrKH5+1PCOzII7Z3bqEPGxdsMIlMRo40jPs42bSfWk3bGXvIJLc9KcKa OT/TNleREdN/qbkqkEbY6rOk37Wme6WDO354tzoY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D70DBF80515; Mon, 8 Nov 2021 16:30:35 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A0153F804B1; Mon, 8 Nov 2021 15:21:14 +0100 (CET) Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4EFF9F8007E for ; Mon, 8 Nov 2021 15:21:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4EFF9F8007E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="DvalVyPW" Received: from zn.tnic (p200300ec2f33110093973d8dfcf40fd9.dip0.t-ipconnect.de [IPv6:2003:ec:2f33:1100:9397:3d8d:fcf4:fd9]) (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 D08561EC04E4; Mon, 8 Nov 2021 15:21:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1636381269; 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=oWsCJGhsvF17zUFafKKKz1XGvPrCUoTgLb0x72qzY0w=; b=DvalVyPWlBMIVGIell7SDhnTX9Q86iHxoTdmXzPxorrW7sqlHpzQzwtFgZEI1KmHXq30Gs yOE/y0FWs3djKZaj7cQDtIyWYYD5AKtdhjFE5l3EWLo8DNcP+YE1HL9C5d3kHwZrzRPHP8 xiS/nYCk2AFbtbv/wLq5RqiIdGlMN38= Date: Mon, 8 Nov 2021 15:21:04 +0100 From: Borislav Petkov To: Geert Uytterhoeven Subject: Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered Message-ID: References: <20211108101157.15189-1-bp@alien8.de> <20211108101157.15189-43-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Mon, 08 Nov 2021 16:29:18 +0100 Cc: ALSA Development Mailing List , the arch/x86 maintainers , Linux-sh list , linux-iio@vger.kernel.org, "open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM" , linux-hyperv@vger.kernel.org, "open list:BROADCOM NVRAM DRIVER" , netdev , Ayush Sawal , sparclinux , linux-clk , linux-leds , linux-s390 , scsi , Rohit Maheshwari , linux-staging@lists.linux.dev, bcm-kernel-feedback-list , openipmi-developer@lists.sourceforge.net, xen-devel@lists.xenproject.org, "open list:TENSILICA XTENSA PORT \(xtensa\)" , Arnd Bergmann , Linux PM list , Intel Graphics Development , Vinay Kumar Yadav , linux-um , Steven Rostedt , rcu@vger.kernel.org, Linux Fbdev development list , linux-tegra , Thomas Gleixner , intel-gvt-dev@lists.freedesktop.org, Linux ARM , linux-edac@vger.kernel.org, Parisc List , Greg Kroah-Hartman , USB list , LKML , Linux-Renesas , Linux Crypto Mailing List , alpha , linuxppc-dev X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, Nov 08, 2021 at 03:07:03PM +0100, Geert Uytterhoeven wrote: > I think the addition of __must_check is overkill, leading to the > addition of useless error checks and message printing. See the WARN in notifier_chain_register() - it will already do "message printing". > Many callers call this where it cannot fail, and where nothing can > be done in the very unlikely event that the call would ever start to > fail. This is an attempt to remove this WARN() hack in notifier_chain_register() and have the function return a proper error value instead of this "Currently always returns zero." which is bad design. Some of the registration functions around the tree check that retval and some don't. So if "it cannot fail" those registration either should not return a value or callers should check that return value - what we have now doesn't make a whole lot of sense. Oh, and then fixing this should avoid stuff like: + if (notifier_registered == false) { + mce_register_decode_chain(&amdgpu_bad_page_nb); + notifier_registered = true; + } from propagating in the code. The other idea I have is to add another indirection in notifier_chain_register() which will check the *proper* return value of a lower level __notifier_chain_register() and then issue that warning. That would definitely avoid touch so many call sites. Bottom line is: what we have now needs cleaning up. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette