RE: [PATCH v5 3/4] iommufd: Add IOMMU_GET_HW_INFO

From: Liu, Yi L
Date: Tue Aug 08 2023 - 13:05:17 EST


> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Tuesday, August 8, 2023 9:03 PM
>
> On Mon, Aug 07, 2023 at 08:49:27AM +0000, Liu, Yi L wrote:
>
> > > > > + /* driver has hw_info callback should have a unique hw_info_type */
> > > > > + if (WARN_ON_ONCE(hw_info_type == IOMMU_HW_INFO_TYPE_NONE))
> {
> > > > > + rc = -ENODEV;
> > > > > + goto out_err;
> > > > > + }
> > > > > +
> > > > > + length = min(cmd->data_len, data_len);
> > > > > + if (copy_to_user(user_ptr, data, length)) {
> > > > > + rc = -EFAULT;
> > > > > + goto out_err;
> > > > > + }
> > > > > +
> > > > > +done:
> > >
> > > No label here, put it in a if {}
> >
> > How about below?
>
> Looks better
>
> You could also consider putting the content of the if {} in a function

Sure.

Regards,
Yi Liu