Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp6343063pxb; Mon, 8 Nov 2021 07:07:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcXgEV2LtPlW5GBzILgwLOaolwzKLRObxYRH3E4kz34nss4fQUGtlUESiN4WNtrhGA4k2l X-Received: by 2002:a05:6638:1607:: with SMTP id x7mr208310jas.27.1636384066870; Mon, 08 Nov 2021 07:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636384066; cv=none; d=google.com; s=arc-20160816; b=aZCH6Q2bAeWT5EoaiZ1ov83UsbQ+nD6GIk3p5QYxSrMtrH/mYC1ChHmYuIHxUhRxGZ Zk6J5/s+Lspz4BQMdjeHcQuzUzOjwzBKWfKwe1WsQ7sk4Y/oxbAQf/N1YUtSOeOLtpQG DZ1lkcBsnbQOZGD9log6EP1LDPqiO/TJD4TM7TQ52j8job31ryy2B7LBhOOqFnnmWam3 oBdHBKVArZ96t+BrgmQv2vVczjvHMezWOB77oP92zhexY236YaUjdbCbzACE8QIFLUzX NY8evO8s+xsqQLM4wGulHcJBnbmZptFXMkpBfiNrMLLEVZjRzf0yG4EAYO5s7dIAV3gZ Bp2Q== 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=EDLyGocz9rytqIbGe7X89CW+E8HRMrCN5y//O5rYdts=; b=ZoTx+5k31T5Ddv6dZG72YnjRrvd5fObmiqGBvlji/FCFYmvPBwb+FZ6yJQuTokMdza tnOLaFU2ebtOPDIJqjKEkxti7m0vLYy1ioQLHbzcVFcfMzOO2g3SQrr0MBO3a3IPQwED fEGh2253gFZNvzNtxEfMDhS3c/u3fIuxIaU0sHOaX2GBz6sifG5ZJXwELSlmHFUdko8K wttyeIIMei2RoBF+tz/+KHVAoRKMtPUr4kmOR0RMWFOSGImfyoToDhue0OsPZ7IxCYga nnppHyMhsTKglYMkfm0Z2mHNIrq68J1N6+I2gjBD7hVxBt6xwLlg8/PoY8Jv07ZFeO10 /VPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cjdviCK5; 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 n10si15248039ilk.161.2021.11.08.07.07.31; Mon, 08 Nov 2021 07:07:46 -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=cjdviCK5; 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 S238663AbhKHKRA (ORCPT + 99 others); Mon, 8 Nov 2021 05:17:00 -0500 Received: from mail.skyhub.de ([5.9.137.197]:38270 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237854AbhKHKPE (ORCPT ); Mon, 8 Nov 2021 05:15:04 -0500 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 5E3121EC04EE; Mon, 8 Nov 2021 11:12:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1636366339; 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=EDLyGocz9rytqIbGe7X89CW+E8HRMrCN5y//O5rYdts=; b=cjdviCK5qMwuOFIfwHjSjcp/N+RnyWtogu3+vq3ivS0FbP0qB4+Z4qOnImB/GLm0sKDjYl H3iN43l689t26B0ymb2ccQfxJ3Gn0RO5/f4ofLWdK3P9aDx1zULUyK+SvNpf+0QuP7xAlO PCX60s4jevh+V15tmhRkkBiY4xrgO+I= From: Borislav Petkov To: LKML Cc: linux-remoteproc@vger.kernel.org Subject: [PATCH v0 14/42] remoteproc: Check notifier registration return value Date: Mon, 8 Nov 2021 11:11:29 +0100 Message-Id: <20211108101157.15189-15-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: linux-remoteproc@vger.kernel.org --- drivers/remoteproc/qcom_common.c | 3 ++- drivers/remoteproc/qcom_sysmon.c | 4 +++- drivers/remoteproc/remoteproc_core.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index 4b91e3c9eafa..61a7812fe4df 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -390,7 +390,8 @@ void *qcom_register_ssr_notifier(const char *name, struct notifier_block *nb) if (IS_ERR(info)) return info; - srcu_notifier_chain_register(&info->notifier_list, nb); + if (srcu_notifier_chain_register(&info->notifier_list, nb)) + pr_warn("SSR notifier already registered\n"); return &info->notifier_list; } diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index 9fca81492863..ffe7811f8aac 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -673,7 +673,9 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc, rproc_add_subdev(rproc, &sysmon->subdev); sysmon->nb.notifier_call = sysmon_notify; - blocking_notifier_chain_register(&sysmon_notifiers, &sysmon->nb); + + if (blocking_notifier_chain_register(&sysmon_notifiers, &sysmon->nb)) + pr_warn("sysmon notifier already registered\n"); mutex_lock(&sysmon_lock); list_add(&sysmon->node, &sysmon_list); diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 502b6604b757..18d477e6141a 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2790,7 +2790,9 @@ static int rproc_panic_handler(struct notifier_block *nb, unsigned long event, static void __init rproc_init_panic(void) { rproc_panic_nb.notifier_call = rproc_panic_handler; - atomic_notifier_chain_register(&panic_notifier_list, &rproc_panic_nb); + + if (atomic_notifier_chain_register(&panic_notifier_list, &rproc_panic_nb)) + pr_warn("Remote Proc notifier already registered\n"); } static void __exit rproc_exit_panic(void) -- 2.29.2