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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB83FC4167D for ; Fri, 10 Dec 2021 18:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242244AbhLJSgR (ORCPT ); Fri, 10 Dec 2021 13:36:17 -0500 Received: from mail-ot1-f49.google.com ([209.85.210.49]:34439 "EHLO mail-ot1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232658AbhLJSgO (ORCPT ); Fri, 10 Dec 2021 13:36:14 -0500 Received: by mail-ot1-f49.google.com with SMTP id x19-20020a9d7053000000b0055c8b39420bso10512528otj.1; Fri, 10 Dec 2021 10:32:38 -0800 (PST) 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=XYFeMefDtygzQHG6cGasFJft83PyhMCvIHgML7JQ1W8=; b=BT8rQ4Lwys6f0lHis7r+7jzL1KmTsfZlI2M6WpJdgfDrW3ZbR5zdfZwpIlyp3Hp6RS pk3HfiMPTZPvnPYMsNynL64Vew06v83zWSayDb2GcA2Kv3BmS9uxJuRCg9iBWb9mMErO tNlccmuVurJkG5/Ykst8sU6MiwvbV6Md0TZp5DcCcSlEFyeA51i9kzNaeyEjQBwakkNc Hhldlrgl/1v3LWbWLFmC7fKf6hnNdAECtE7mNXhCwU0p/SIgT2QGrEQswtJ+GrFP3auU oCFP/ayzlf+HGIsoP/YBFB/MWEoZoczZUBvb5HjKLP7kS8lkOVhqPGve8FS96GEK2rws m/Yg== X-Gm-Message-State: AOAM532QPLjoi1gQbvHvSzI9O8ifmbE8jvJ0y7c+iB2plRn4xo272OkU TnDYvx/sJYHs/OI68cqHvO7dlLh2t5NpN6wVLp8= X-Google-Smtp-Source: ABdhPJy/ApH2I9ley83OfAtDiEoSWuJBoE9Gqun3QKF0IviB+39TRacgd3bR+5yVv4MXsqS5F4aemy99lcaDR84MB0I= X-Received: by 2002:a05:6830:348f:: with SMTP id c15mr12642134otu.254.1639161158278; Fri, 10 Dec 2021 10:32:38 -0800 (PST) MIME-Version: 1.0 References: <20211126180101.27818-1-digetx@gmail.com> <20211126180101.27818-7-digetx@gmail.com> In-Reply-To: <20211126180101.27818-7-digetx@gmail.com> From: "Rafael J. Wysocki" Date: Fri, 10 Dec 2021 19:32:27 +0100 Message-ID: Subject: Re: [PATCH v4 06/25] reboot: Warn if unregister_restart_handler() fails To: Dmitry Osipenko Cc: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Rafael J. Wysocki" , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , Linux ARM , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev , linux-riscv@lists.infradead.org, Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM , linux-tegra Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Fri, Nov 26, 2021 at 7:02 PM Dmitry Osipenko wrote: > > Emit warning if unregister_restart_handler() fails since it never should > fail. This will ease further API development by catching mistakes early. > > Signed-off-by: Dmitry Osipenko > --- > kernel/reboot.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/reboot.c b/kernel/reboot.c > index e6659ae329f1..f0e7b9c13f6b 100644 > --- a/kernel/reboot.c > +++ b/kernel/reboot.c > @@ -210,7 +210,7 @@ EXPORT_SYMBOL(register_restart_handler); > */ > int unregister_restart_handler(struct notifier_block *nb) > { > - return atomic_notifier_chain_unregister(&restart_handler_list, nb); > + return WARN_ON(atomic_notifier_chain_unregister(&restart_handler_list, nb)); The only reason why it can fail is if the object pointed to by nb is not in the chain. Why WARN() about this? And what about systems with panic_on_warn set? > } > EXPORT_SYMBOL(unregister_restart_handler); > > -- > 2.33.1 >