On Wed, Feb 12, 2020 at 12:07:28PM -0500, Vivek Goyal wrote:
> +int dax_pgoff(sector_t dax_offset, sector_t sector, size_t size, pgoff_t 
> *pgoff)
> +{
> +     phys_addr_t phys_off = (dax_offset + sector) * 512;
> +
> +     if (pgoff)
> +             *pgoff = PHYS_PFN(phys_off);
> +     if (phys_off % PAGE_SIZE || size % PAGE_SIZE)
> +             return -EINVAL;
> +     return 0;

This is why we have IS_ERR_VALUE().  Just make this function return
a pgoff_t.
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to