From patchwork Mon Nov 8 10:11:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 12608165 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 671ADC433EF for ; Mon, 8 Nov 2021 10:15:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3A82E611C4 for ; Mon, 8 Nov 2021 10:15:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3A82E611C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oiwca35MBEcC3EajQ/G3nNmr/LB1yWzdiw4ScaEPOKs=; b=Q76nLax8X9K9Ik c8LXf8OgzQ38JMMFlNu9prRGMzzJ7Fnhzn5wsWbq7L3S3nunlZKLR8TUQIOxiB84LSg1HPuxmO4go JhCC2AJ29SkqCkOyu9WI28yxwb8it0UUEQHe0diF9g066ppzbA4tBxf5+e86f3xWHzc64LjDgl/XU o/y6ihM44US/s9AQnRTXdUSheMdPj3Mj35agnpei4uAY9IoGOy7PkP79iUAq2/BFcwoTDTEyWdQZl D0MxLYs55oKEfXLhldokpZJ1FNt69wOfDLp7HiHI3Wrrb5Ezdtw6dNNl7RTTBtspZcbhhW7T46OVM dWSSYm/ZsYKws8Ljy+GQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk1da-00Fyuw-9s; Mon, 08 Nov 2021 10:12:26 +0000 Received: from mail.skyhub.de ([5.9.137.197]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk1dV-00Fyrj-FI for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 10:12:23 +0000 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 EBC641EC04E0; Mon, 8 Nov 2021 11:12:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1636366333; 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=X/Hn91jrBnlYF021LHj4jTZZybHLn5KSnhf9Ef7LdEA=; b=NeAoIcmaCi5Z+Dgahdru8ptYYODaoo3vHiVvX3JjxGdyJLE2lL5nZiug0IvwERk4pJyiyz DymQsesyzS5+7+pvdQJHNFtxPaQer5MNWCfkXyqTsrToIJE0DU0z+7IT4DbxKby/q3oOjt XmxxjoiyIcrB5gPDpC2rm/04gA32vLw= From: Borislav Petkov To: LKML Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH v0 06/42] firmware: Check notifier registration return value Date: Mon, 8 Nov 2021 11:11:21 +0100 Message-Id: <20211108101157.15189-7-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_021221_690998_07E6CB36 X-CRM114-Status: GOOD ( 12.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Borislav Petkov Avoid homegrown notifier registration checks. No functional changes. Signed-off-by: Borislav Petkov Cc: linux-arm-kernel@lists.infradead.org --- drivers/firmware/arm_scmi/notify.c | 3 ++- drivers/firmware/google/gsmi.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c index 0efd20cd9d69..f4c42ac00c63 100644 --- a/drivers/firmware/arm_scmi/notify.c +++ b/drivers/firmware/arm_scmi/notify.c @@ -1358,7 +1358,8 @@ static int scmi_notifier_register(const struct scmi_handle *handle, if (!hndl) return -EINVAL; - blocking_notifier_chain_register(&hndl->chain, nb); + if (blocking_notifier_chain_register(&hndl->chain, nb)) + pr_warn("SCMI notifier already registered\n"); /* Enable events for not pending handlers */ if (!IS_HNDL_PENDING(hndl)) { diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c index adaa492c3d2d..a658e7c106c3 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -1030,8 +1030,10 @@ static __init int gsmi_init(void) register_reboot_notifier(&gsmi_reboot_notifier); register_die_notifier(&gsmi_die_notifier); - atomic_notifier_chain_register(&panic_notifier_list, - &gsmi_panic_notifier); + + if (atomic_notifier_chain_register(&panic_notifier_list, + &gsmi_panic_notifier)) + pr_warn("gsmi panic notifier already registered\n"); printk(KERN_INFO "gsmi version " DRIVER_VERSION " loaded\n");