Skip to content

Commit 01de5fc

Browse files
roxellrafaeljw
authored andcommitted
PM: hibernate: fix sparse warnings
When building the kernel with sparse enabled 'C=1' the following warnings shows up: kernel/power/swap.c:390:29: warning: incorrect type in assignment (different base types) kernel/power/swap.c:390:29: expected int ret kernel/power/swap.c:390:29: got restricted blk_status_t This is due to function hib_wait_io() returns a 'blk_status_t' which is a bitwise u8. Commit 5416da0 ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io") seemed to have mixed up the return type. However, the 4e4cbee ("block: switch bios to blk_status_t") actually broke the behaviour by returning the wrong type. Rework so function hib_wait_io() returns a 'int' instead of 'blk_status_t' and make sure to call function blk_status_to_errno(hb->error)' when returning from function hib_wait_io() a int gets returned. Fixes: 4e4cbee ("block: switch bios to blk_status_t") Fixes: 5416da0 ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io") Signed-off-by: Anders Roxell <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c1bfc59 commit 01de5fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/power/swap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,
299299
return error;
300300
}
301301

302-
static blk_status_t hib_wait_io(struct hib_bio_batch *hb)
302+
static int hib_wait_io(struct hib_bio_batch *hb)
303303
{
304304
/*
305305
* We are relying on the behavior of blk_plug that a thread with
306306
* a plug will flush the plug list before sleeping.
307307
*/
308308
wait_event(hb->wait, atomic_read(&hb->count) == 0);
309-
return hb->error;
309+
return blk_status_to_errno(hb->error);
310310
}
311311

312312
/*

0 commit comments

Comments
 (0)