[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170515111323.10640-1-mika.westerberg@linux.intel.com>
Date: Mon, 15 May 2017 14:13:23 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] nvmem: core: Prevent memory leak when device is unregistered
The nvmem_unregister() calls device_del() for the device but forgets to
call put_device() to actually release the device object which causes
that memory to be leaked.
Fix this by calling device_unregister() for the device intead which also
calls put_device() for the device releasing it eventually.
Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
---
drivers/nvmem/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 8c830a80a648..112c8072e0f3 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -528,7 +528,7 @@ int nvmem_unregister(struct nvmem_device *nvmem)
device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom);
nvmem_device_remove_all_cells(nvmem);
- device_del(&nvmem->dev);
+ device_unregister(&nvmem->dev);
return 0;
}
--
2.11.0
Powered by blists - more mailing lists