![John Audia](/assets/img/avatar_default.png)
Manually rebased: backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch Removed upstreamed: backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch[1] patches-5.10/070-net-bgmac-fix-BCM5358-support-by-setting-correct-fla.patch[2] Add fix: target/linux/generic/backport-5.10/804-0001-net-Remove-WARN_ON_ONCE-sk-sk_forward_alloc-from-sk_.patch[3] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.169&id=a19a0f67dbb89ad2bfc466f2003841acba645884 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.169&id=a5c51e0c3202820192db3f3809e072f3ca2b1177 3. https://lore.kernel.org/stable/20230227211548.13923-1-kuniyu@amazon.com Signed-off-by: John Audia <therealgraysky@proton.me>
31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
From 8c751e0d9a5264376935a84429a2d468c8877d99 Mon Sep 17 00:00:00 2001
|
|
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
|
Date: Sun, 20 Feb 2022 15:15:17 +0000
|
|
Subject: [PATCH] nvmem: core: Check input parameter for NULL in
|
|
nvmem_unregister()
|
|
|
|
nvmem_unregister() frees resources and standard pattern is to allow
|
|
caller to not care if it's NULL or not. This will reduce burden on
|
|
the callers to perform this check.
|
|
|
|
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|
Link: https://lore.kernel.org/r/20220220151527.17216-4-srinivas.kandagatla@linaro.org
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
---
|
|
drivers/nvmem/core.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/nvmem/core.c
|
|
+++ b/drivers/nvmem/core.c
|
|
@@ -904,7 +904,8 @@ static void nvmem_device_release(struct
|
|
*/
|
|
void nvmem_unregister(struct nvmem_device *nvmem)
|
|
{
|
|
- kref_put(&nvmem->refcnt, nvmem_device_release);
|
|
+ if (nvmem)
|
|
+ kref_put(&nvmem->refcnt, nvmem_device_release);
|
|
}
|
|
EXPORT_SYMBOL_GPL(nvmem_unregister);
|
|
|