[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1490149546-4062-1-git-send-email-jeffy.chen@rock-chips.com>
Date: Wed, 22 Mar 2017 10:25:45 +0800
From: Jeffy Chen <jeffy.chen@...k-chips.com>
To: linux-kernel@...r.kernel.org
Cc: robh@...nel.org, toshi.kani@....com, shawn.lin@...k-chips.com,
briannorris@...omium.org, dianders@...omium.org,
bhelgaas@...gle.com, dtor@...omium.org,
Jeffy Chen <jeffy.chen@...k-chips.com>
Subject: [PATCH 1/2] resource: Copy the whole res in resource_list_create_entry
We do this so the callers may not need worry about when to free the
allocated resource struct.
Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
---
kernel/resource.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 9b5f044..f3594f8 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1595,7 +1595,9 @@ struct resource_entry *resource_list_create_entry(struct resource *res,
entry = kzalloc(sizeof(*entry) + extra_size, GFP_KERNEL);
if (entry) {
INIT_LIST_HEAD(&entry->node);
- entry->res = res ? res : &entry->__res;
+ entry->res = &entry->__res;
+ if (res)
+ entry->__res = *res;
}
return entry;
--
2.1.4
Powered by blists - more mailing lists