• Dong Jia Shi's avatar
    vfio: ccw: refactor and improve pfn_array_alloc_pin() · 5c1cfb1c
    Dong Jia Shi authored
    This refactors pfn_array_alloc_pin() and also improves it by adding
    defensive code in error handling so that calling pfn_array_unpin_free()
    after error return won't lead to problem. This mainly does:
    1. Merge pfn_array_pin() into pfn_array_alloc_pin(), since there is no
       other user of pfn_array_pin(). As a result, also remove kernel-doc
       for pfn_array_pin() and add/update kernel-doc for pfn_array_alloc_pin()
       and struct pfn_array.
    2. For a vfio_pin_pages() failure, set pa->pa_nr to zero to indicate
       zero pages were pinned.
    3. Set pa->pa_iova_pfn to NULL right after it was freed.
    Suggested-by: default avatarPierre Morel <pmorel@linux.ibm.com>
    Signed-off-by: default avatarDong Jia Shi <bjsdjshi@linux.ibm.com>
    Message-Id: <20180523025645.8978-3-bjsdjshi@linux.ibm.com>
    Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
    5c1cfb1c
vfio_ccw_cp.c 20.7 KB