s390/cio: Fix cleanup of pfn_array alloc failure
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 54 lines · Eric Farman
Quoted 51 lines · Cornelia Huck
Quoted 48 lines · On Mon, 12 Nov 2018 11:41:50 +0100 Pierre Morel <[email protected]> wrote:
Quoted 46 lines · Cornelia Huck
Quoted 34 lines · On Mon, 12 Nov 2018 11:28:38 +0100 Pierre Morel <[email protected]> wrote:
Hi Eric,
I think the problem here comes from the
pfn_array_table_unpin_free()doing both unpin and free.I would prefer that you change the�
pfn_array_table_init()to return the
pointer, so you can free the pointer in the caller like:���������� p =
pfn_array_table_init(pat, 1);
���������� if (!p)
������������������ gotoout_init;���������� ret =
pfn_array_alloc_pin(pat->pat_pa, cp->mdev, ccw->cda, ccw->count);
���������� if (ret < 0)
������������������ gotoout_free;
...
out_unpin:
����������pfn_array_table_unpin_free(pat, cp->mdev);out_free:
����pfn_array_table_free(p);out_init:
����������ccw->cda= 0;
���������� return ret;
}And modify the
pfn_array_table_unpin_free()topfn_array_table_unpin()and add the freeing inpfn_array_table_free(p).Quoted 5 lines
Something like that with a correct return code handle.
Which would make the code more logical and readable.
What do you think?
While I agree that this would improve the code, I'm not sure how much of it remains at the end of this series (I haven't read it completely yet.) IOW, is this a code change that would get kicked out again anyway?
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
At the end,pfn_array_alloc_pin() is decoupled in
pfn_array_alloc()andpfn_array_pin()which is a good thing but but thepfn_array_unpin_free()survives as unpin + free.And don't forget,
pfn_array_table_unpin_free()goes away entirely.� I do add a
check for a
Quoted 2 lines
non-zero iova in patch 8.
Sorry. Coffee hasn't kicked in yet. :)
Quoted 3 lines
Quoted 3 lines
OK, this seems like a good idea to me, then :)