Skip to contentSkip to conversation

power: snapshot: Optimize the error variable in the snapshot_write_next()

PATCH Applied Li zeming 2 participants 2 messages Oct 24, 2023 – Dec 11, 2023

Subsystems (2)
lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 power: snapshot: Optimize the error variable in the snapshot_write_next()

Assign a value when removing the definition for error, which is assigned before use.

---
 kernel/power/snapshot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/snapshot.c +1 -1
index 87e9f7e2bdc05..40c141144c9a1 100644
@@ -2776,7 +2776,7 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
 int snapshot_write_next(struct snapshot_handle *handle)
 {
 	static struct chain_allocator ca;
-	int error = 0;
+	int error;
 
 next:
 	/* Check if we have already loaded the entire image */
Signature · 1 line
2.18.2
maintainer Applied
#1 lore raw
Quoted 14 lines · Li zeming

Assign a value when removing the definition for error, which is assigned before use.

---
 kernel/power/snapshot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/snapshot.c +0 -0
index 87e9f7e2bdc05..40c141144c9a1 100644

kernel/power/snapshot.c static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)

Quoted 9 lines
kernel/power/snapshot.c +1 -2
@@ -2776,7 +2776,7 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
 int snapshot_write_next(struct snapshot_handle *handle)
 {
        static struct chain_allocator ca;
-       int error = 0;
+       int error;
 
 next:
        /* Check if we have already loaded the entire image */
--

Applied as 6.8 material with rewritten subject and changelog.

Thanks!