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

From: Jason Gunthorpe
Date: Tue Aug 08 2023 - 12:11:43 EST


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

Jason