From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C96403B38B9; Thu, 17 Sep 2026 16:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789663914; cv=none; b=rvOJxCZX5VVvI8aH1EMcNIMXpUkoXdiwiB44jV0IYCriNS3ITXU2R0W76YgzviH/xgAQ6CBUgYTAMT6meg5Bqo8nDLur29cmutohN9h/67vKvr6AMV5k+mlCe60VHndhwBSGM9uPJT+m9i9GD2QKCD2NKIM4wZegMXiymiJkHrw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789663914; c=relaxed/simple; bh=HxFv5e1HqX8E9rpSV2BkxjmKY+SaIsPI+q/IpvSMJ7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Us1aC8Lo3IfVisoo+e3FI0WtKjED8wz+b69nxnakLTldBamHSy7JuqlAecRb2dO207HWLNRzfqeBOXDQKkgk35uA1x65fvessX/f50cPFxkJXboy3DvGNLndWN37kbKnXg58vh6h2Rk55iQ9rAOHmjOeYJ0nZ931bqzYenQw7Wc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Na9VOBxM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Na9VOBxM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2829D1F000FF; Thu, 17 Sep 2026 16:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789663912; bh=Bh+SFC/jVS/yjsca/3GeXIYXx9G4fk8H6hm9p1unRJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Na9VOBxMMO0+gJZJJoEkzIhSNmo9j00jLuPhezqwsKC16KAxXa1hdobvlaSshRSG0 BxDJnijf/p0Jkt+cBTbfy4pLHDtRQJqLgD3HksEdN7L2XqQfLWoSZ9d/LA5/5eZq6M PNQ4Iyjxm5lmaw1lhD1pJX9JLrL9f2+VjLrwlEkQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arnd Bergmann , Tellakula Yeswanth Krishna , Venkat Rao Bagalkote , "Ritesh Harjani (IBM)" , Sasha Levin Subject: [PATCH 6.18 0196/1250] char/nvram: Remove redundant nvram_mutex Date: Thu, 17 Sep 2026 15:59:51 +0100 Message-ID: <20260917151557.430173401@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151551.901433442@linuxfoundation.org> References: <20260917151551.901433442@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Venkat Rao Bagalkote [ Upstream commit e8c715f3a7dae43fabae261493a26474fec11863 ] The global nvram_mutex in drivers/char/nvram.c is redundant and unused, and this triggers compiler warnings on some configurations. All platform-specific nvram operations already provide their own internal synchronization, meaning the wrapper-level mutex does not provide any additional safety. Remove the nvram_mutex definition along with all remaining lock/unlock users across PPC32, x86, and m68k code paths, and rely entirely on the per-architecture nvram implementations for locking. Reviewed-by: Arnd Bergmann Suggested-by: Arnd Bergmann Tested-by: Tellakula Yeswanth Krishna Signed-off-by: Venkat Rao Bagalkote Tested-by: yeswanth Reviewed-by: Ritesh Harjani (IBM) Link: https://patch.msgid.link/20260428061540.73668-1-venkat88@linux.ibm.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/char/nvram.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 9eff426a92865..e89cc1f1c89ea 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -53,7 +53,6 @@ #include #endif -static DEFINE_MUTEX(nvram_mutex); static DEFINE_SPINLOCK(nvram_state_lock); static int nvram_open_cnt; /* #times opened */ static int nvram_open_mode; /* special open modes */ @@ -310,11 +309,8 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd, break; #ifdef CONFIG_PPC32 case IOC_NVRAM_SYNC: - if (ppc_md.nvram_sync != NULL) { - mutex_lock(&nvram_mutex); + if (ppc_md.nvram_sync) ppc_md.nvram_sync(); - mutex_unlock(&nvram_mutex); - } ret = 0; break; #endif @@ -324,11 +320,8 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd, if (!capable(CAP_SYS_ADMIN)) return -EACCES; - if (arch_nvram_ops.initialize != NULL) { - mutex_lock(&nvram_mutex); + if (arch_nvram_ops.initialize) ret = arch_nvram_ops.initialize(); - mutex_unlock(&nvram_mutex); - } break; case NVRAM_SETCKS: /* just set checksum, contents unchanged (maybe useful after @@ -336,11 +329,8 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd, if (!capable(CAP_SYS_ADMIN)) return -EACCES; - if (arch_nvram_ops.set_checksum != NULL) { - mutex_lock(&nvram_mutex); + if (arch_nvram_ops.set_checksum) ret = arch_nvram_ops.set_checksum(); - mutex_unlock(&nvram_mutex); - } break; #endif /* CONFIG_X86 || CONFIG_M68K */ } -- 2.53.0