drivers/base/memory.c: fix kw reported issue

Fix KW reported 'NULL pointer dereference' issue. This is fixed in the
upstream as part of 848e19ad3c335 ("drivers/base/memory.c: drop the
mem_sysfs_mutex") but the reason not to pick this up as it is that it
contains the additional changes not so important for 4.19 kernels.

Change-Id: I7cb5b5202c29b280c853b849f29201d70520faf5
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
Charan Teja Reddy 2020-06-12 18:51:50 +05:30 committed by Gerrit - the friendly Code Review server
parent 49f043455b
commit 4a54f26716

View File

@ -845,6 +845,8 @@ int create_memory_block_devices(unsigned long start, unsigned long size)
for (block_id = start_block_id; block_id != end_block_id;
block_id++) {
mem = find_memory_block_by_id(block_id, NULL);
if (WARN_ON_ONCE(!mem))
continue;
mem->section_count = 0;
unregister_memory(mem);
}