lkml.org 
[lkml]   [2022]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFT][PATCH v2 1/9] vfio: Make vfio_unpin_pages() return void
    On Tue, Jul 05, 2022 at 11:54:50PM -0700, Christoph Hellwig wrote:
    > > +void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
    > > + int npage)
    > > {
    > > struct vfio_container *container;
    > > struct vfio_iommu_driver *driver;
    > > - int ret;
    > >
    > > - if (!user_pfn || !npage || !vfio_assert_device_open(device))
    > > - return -EINVAL;
    > > + if (WARN_ON_ONCE(!user_pfn || !npage || !vfio_assert_device_open(device)))
    >
    > This adds an overly long line. Note that I think in general it is
    > better to have an individual WARN_ON per condition anyway, as that
    > allows to directly pinpoint what went wrong when it triggers.

    Following patches are touching this line too. And it'll be shrunk
    to a shorter line eventually by the end of PATCH-9.

    Yet, I can separate them as you pointed out.

    > > + if (WARN_ON_ONCE(unlikely(!driver || !driver->ops->unpin_pages)))
    > > + return;
    >
    > I'd just skip this check an let it crash. If someone calls unpin
    > on something totally random that wasn't even pinned we don't need to
    > handle that gracefully.

    Makes sense. I can drop that in next version.

    > Reviewed-by: Christoph Hellwig <hch@lst.de>

    Will add to v3. Thanks for the review!

    \
     
     \ /
      Last update: 2022-07-06 17:55    [W:2.989 / U:0.468 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site