Nicolin Chen e8f90717ed vfio: Make vfio_unpin_pages() return void
There's only one caller that checks its return value with a WARN_ON_ONCE,
while all other callers don't check the return value at all. Above that,
an undo function should not fail. So, simplify the API to return void by
embedding similar WARN_ONs.

Also for users to pinpoint which condition fails, separate WARN_ON lines,
yet remove the "driver->ops->unpin_pages" check, since it's unreasonable
for callers to unpin on something totally random that wasn't even pinned.
And remove NULL pointer checks for they would trigger oops vs. warnings.
Note that npage is already validated in the vfio core, thus drop the same
check in the type1 code.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Tested-by: Terrence Xu <terrence.xu@intel.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/r/20220723020256.30081-2-nicolinc@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2022-07-23 07:29:10 -06:00
..
2022-02-08 22:57:32 -08:00
2019-07-15 11:03:03 -03:00
2020-10-16 15:02:21 -07:00
2021-07-25 09:21:21 +01:00
2022-03-23 17:52:33 -07:00
2019-07-26 08:15:26 -06:00
2019-06-07 11:35:15 -06:00
2022-02-07 16:35:35 -08:00
2022-03-25 14:18:28 +01:00
2016-09-06 09:14:52 -06:00
2020-06-02 20:32:53 -03:00
2020-12-10 22:37:32 +01:00
2022-02-21 18:00:30 +01:00
2018-04-20 19:14:40 -04:00
2016-09-06 09:14:52 -06:00