Fan Ni wrote:
> The 06/02/2023 23:14, Dan Williams wrote:
> > Now that free_dev_dax_id() internally manages the references it needs
> > the extra references taken by the dax_region drivers are not needed.
> > 
> > Reported-by: Ira Weiny <ira.we...@intel.com>
> > Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
> 
> Reviewed-by: Fan Ni <fan...@samsung.com>
> One minor comment as below.
> 

[snip]

> >  static struct platform_driver dax_hmem_driver = {
> > diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c
> > index f050ea78bb83..ae0cb113a5d3 100644
> > --- a/drivers/dax/pmem.c
> > +++ b/drivers/dax/pmem.c
> > @@ -13,7 +13,6 @@ static struct dev_dax *__dax_pmem_probe(struct device 
> > *dev)
> >     int rc, id, region_id;
> >     resource_size_t offset;
> >     struct nd_pfn_sb *pfn_sb;
> > -   struct dev_dax *dev_dax;
> >     struct dev_dax_data data;
> >     struct nd_namespace_io *nsio;
> >     struct dax_region *dax_region;
> > @@ -65,12 +64,8 @@ static struct dev_dax *__dax_pmem_probe(struct device 
> > *dev)
> >             .pgmap = &pgmap,
> >             .size = range_len(&range),
> >     };
> > -   dev_dax = devm_create_dev_dax(&data);
> >  
> > -   /* child dev_dax instances now own the lifetime of the dax_region */
> > -   dax_region_put(dax_region);
> > -
> > -   return dev_dax;
> > +   return devm_create_dev_dax(&data);
> 
> Not related to the patch, but why we do not need to check the returned
> value of devm_create_dev_dax as above?

__dax_pmem_probe() returns struct dev_dax * so we just pass the result on.

> Or do we really need the check as
> the function already returns ERR_PTR if failed?

Yea the caller of __dax_pmem_probe() needs to handle it.

Ira

Reply via email to