Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp6336649pxb; Mon, 8 Nov 2021 07:02:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJziivRKm4NaAcwXkuLWppEleFn5958D9va+XYtq2OeqlK1ZwIQpIgThZbTIIboGWa+OuLtv X-Received: by 2002:a05:6638:3784:: with SMTP id w4mr171245jal.144.1636383751195; Mon, 08 Nov 2021 07:02:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636383751; cv=none; d=google.com; s=arc-20160816; b=rmiNW9leHep2gOTldpSWZepi3IMqfPek95PYgLOREKMxXpQVQtSeYOzi3PUXon4i7y 3VOqAx/JRblqtSED9keggndYwjsvbC0sjGjFg1JNhLlICcIHwhJF9WyqmR5CVzxJUQId R8qh1jSU6u+QaG0wmL6h64eFPWbeH9JtggQL/nxEBsGoDrwADmNQumlpZGc1gtROLHkz O7/aiisxET0IxDaWI59peU5Lh7LkiVO+VqR7e3/rJ1cb0xVoK/YLSPDv2h9WPzBDthGP p+6MLozsNUwZBeWF7raJZCsqj7n1HAXGoZF26m+Ux8WYmvUiCgyLvq2522lSU8l6ZpdC CFKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BFq9wMoiEcM4ke+MTRBzDm8LDUO4bEBhPpFd5qQWnyI=; b=EI76q924IrJleJodiDr/4C5RmKH9AWvrUgn1NGYWr8d0C0FeGfsokK7tZIqqjCi7dh AY8Nqteb0SOAmNxRDKpMJ206yf8H/fBIqlqxYbHamH9knkzO1TLfg0k0P0q6SZKzlUWf V0nePqM1hXYknTQEmfY3Tdin+hEqXvom9qE5UG2uDlWr8Bny10o2gYd1hmDG+htsQWhY wsN082GMADCL56zAEEWG4l+4DElpflb5oknRcY/AZje3NGI2aS2/8JMGxyASXkRfXa3W npwPMkotInE7+4kt5iozRQyT6gibyMYhqvp4gCWeReGAcD9iuhToD1PB0Hc2t+cfphCE BVcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=JpAVisHH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si38078770ilg.74.2021.11.08.07.02.16; Mon, 08 Nov 2021 07:02:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=JpAVisHH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238656AbhKHKQ4 (ORCPT + 99 others); Mon, 8 Nov 2021 05:16:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237842AbhKHKPD (ORCPT ); Mon, 8 Nov 2021 05:15:03 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1449C061714 for ; Mon, 8 Nov 2021 02:12:18 -0800 (PST) Received: from zn.tnic (p200300ec2f33110088892b77bd117736.dip0.t-ipconnect.de [IPv6:2003:ec:2f33:1100:8889:2b77:bd11:7736]) (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 011761EC0501; Mon, 8 Nov 2021 11:12:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1636366337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BFq9wMoiEcM4ke+MTRBzDm8LDUO4bEBhPpFd5qQWnyI=; b=JpAVisHHJRty1TqzHW7fiv5Qffxj8K9BiYhvlLslKD7P+0XA0GXN/cDcHSsOxd77gP02C2 VBh4LGxgMrBnGDb1ZalRy5E2CATp4d3JnKgcycPPzxyKvSbrkHw0lLn2P7tttoHql/r7E+ 8VvAekPGjIRBwIqXuIyvwVy4iL6FHLg= From: Borislav Petkov To: LKML Cc: Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v0 11/42] misc: Check notifier registration return value Date: Mon, 8 Nov 2021 11:11:26 +0100 Message-Id: <20211108101157.15189-12-bp@alien8.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211108101157.15189-1-bp@alien8.de> References: <20211108101157.15189-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Avoid homegrown notifier registration checks. No functional changes. Signed-off-by: Borislav Petkov Cc: Arnd Bergmann Cc: Greg Kroah-Hartman --- drivers/misc/ibmasm/heartbeat.c | 3 ++- drivers/misc/pvpanic/pvpanic.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/ibmasm/heartbeat.c b/drivers/misc/ibmasm/heartbeat.c index 59c9a0d95659..f7c22d9a768b 100644 --- a/drivers/misc/ibmasm/heartbeat.c +++ b/drivers/misc/ibmasm/heartbeat.c @@ -39,7 +39,8 @@ static struct notifier_block panic_notifier = { panic_happened, NULL, 1 }; void ibmasm_register_panic_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier); + if (atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier)) + pr_warn("IBM ASM panic notifier already registered\n"); } void ibmasm_unregister_panic_notifier(void) diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c index 4b8f1c7d726d..6e89e8b1beaf 100644 --- a/drivers/misc/pvpanic/pvpanic.c +++ b/drivers/misc/pvpanic/pvpanic.c @@ -95,7 +95,8 @@ static int pvpanic_init(void) INIT_LIST_HEAD(&pvpanic_list); spin_lock_init(&pvpanic_lock); - atomic_notifier_chain_register(&panic_notifier_list, &pvpanic_panic_nb); + if (atomic_notifier_chain_register(&panic_notifier_list, &pvpanic_panic_nb)) + pr_warn("PV panic notifier already registered\n"); return 0; } -- 2.29.2