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 8CEE3C433F5 for ; Mon, 8 Nov 2021 16:12:53 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 5851F6108B for ; Mon, 8 Nov 2021 16:12:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5851F6108B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.223501.386244 (Exim 4.92) (envelope-from ) id 1mk7G4-0002Pf-9J; Mon, 08 Nov 2021 16:12:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 223501.386244; Mon, 08 Nov 2021 16:12:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mk7G4-0002PY-67; Mon, 08 Nov 2021 16:12:32 +0000 Received: by outflank-mailman (input) for mailman id 223501; Mon, 08 Nov 2021 16:12:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mk7G3-0002PS-9x for xen-devel@lists.xenproject.org; Mon, 08 Nov 2021 16:12:31 +0000 Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id abe4b77b-40ae-11ec-a9d2-d9f7a1cc8784; Mon, 08 Nov 2021 17:12:30 +0100 (CET) Received: by mail-ua1-f50.google.com with SMTP id q13so32559676uaq.2 for ; Mon, 08 Nov 2021 08:12:30 -0800 (PST) Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com. [209.85.221.181]) by smtp.gmail.com with ESMTPSA id j126sm2496418vsc.17.2021.11.08.08.12.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Nov 2021 08:12:27 -0800 (PST) Received: by mail-vk1-f181.google.com with SMTP id f78so6379000vka.5 for ; Mon, 08 Nov 2021 08:12:27 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: abe4b77b-40ae-11ec-a9d2-d9f7a1cc8784 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hEQQmRj7LTpJogPgt2xRVOX7N+txus6iMmGepIZghfU=; b=2VnckiAsO1uFXGD9Dj9uNSq4IgEVrO2agSPymZUuhgt19s1rkmvKNjJI7HffiXt6vV hKK2eYLULtWgQSOTmIWMOhQsAPVHeOdO0XYpkTRDYlYMW2glUeYYDBAm2Iaj21VOEPXF 7EDCSSHZsD2Sf0l7SObWtpPq+7mIoXjsKbskMCIpVt25bHLBwS5g1zIZiPdn0eYoz47n ks4lY0eMmkCd3+vsqwQIczfZChbchTYgiSMlDtaAqM6CpDAE14gFw6gAZiAFYELC9z1v kfaJKHMI7bzXvJQrWM2XRmAWhzayE3nVr68iWoNiMjA8PzYabZvzraLHEkKjJeKssQL+ J3kg== X-Gm-Message-State: AOAM530kFlxdU/rlTS1nf6+WNrrus2fx9WyNPL/kr/oY4opT18CZCwiU 9va/B+iS4/o2EDZKf3jZfRT/6ia7mnw5cY2N X-Google-Smtp-Source: ABdhPJwc2ba8eTqzvs6aoNFZVs4yF8uM0d7uC7CRQe40pper06ZJi4ustzn2kVfixLKu6jTcU7igOg== X-Received: by 2002:a67:d491:: with SMTP id g17mr137662vsj.41.1636387948682; Mon, 08 Nov 2021 08:12:28 -0800 (PST) X-Received: by 2002:a1f:f24f:: with SMTP id q76mr347755vkh.11.1636387947335; Mon, 08 Nov 2021 08:12:27 -0800 (PST) MIME-Version: 1.0 References: <20211108101157.15189-1-bp@alien8.de> <20211108101157.15189-43-bp@alien8.de> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 8 Nov 2021 17:12:16 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered To: Borislav Petkov Cc: LKML , Thomas Gleixner , Arnd Bergmann , Ayush Sawal , Greg Kroah-Hartman , Rohit Maheshwari , Steven Rostedt , Vinay Kumar Yadav , ALSA Development Mailing List , bcm-kernel-feedback-list , Intel Graphics Development , intel-gvt-dev@lists.freedesktop.org, alpha , Linux ARM , linux-clk , Linux Crypto Mailing List , linux-edac@vger.kernel.org, Linux Fbdev development list , linux-hyperv@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds , "open list:BROADCOM NVRAM DRIVER" , Parisc List , Linux PM list , linuxppc-dev , "open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM" , Linux-Renesas , linux-s390 , scsi , Linux-sh list , linux-staging@lists.linux.dev, linux-tegra , linux-um , USB list , "open list:TENSILICA XTENSA PORT (xtensa)" , netdev , openipmi-developer@lists.sourceforge.net, rcu@vger.kernel.org, sparclinux , "the arch/x86 maintainers" , xen-devel@lists.xenproject.org Content-Type: text/plain; charset="UTF-8" Hi Borislav, On Mon, Nov 8, 2021 at 4:59 PM Borislav Petkov wrote: > On Mon, Nov 08, 2021 at 04:25:47PM +0100, Geert Uytterhoeven wrote: > > I'm not against returning proper errors codes. I'm against forcing > > callers to check things that cannot fail and to add individual error > > printing to each and every caller. > > If you're against checking things at the callers, then the registration > function should be void. IOW, those APIs are not optimally designed atm. Returning void is the other extreme ;-) There are 3 levels (ignoring BUG_ON()/panic () inside the callee): 1. Return void: no one can check success or failure, 2. Return an error code: up to the caller to decide, 3. Return a __must_check error code: every caller must check. I'm in favor of 2, as there are several places where it cannot fail. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds