Linux CXL
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Fan Ni <nifan@outlook.com>, Dan Williams <dan.j.williams@intel.com>
Cc: <nvdimm@lists.linux.dev>, Ira Weiny <ira.weiny@intel.com>,
	<linux-cxl@vger.kernel.org>, <a.manzanares@samsung.com>,
	<dave@stgolabs.net>, <nmtadam.samsung@gmail.com>,
	<nifan@outlook.com>, <fan.ni@samsung.com>
Subject: Re: [PATCH 4/4] dax: Cleanup extra dax_region references
Date: Tue, 6 Jun 2023 13:42:35 -0700	[thread overview]
Message-ID: <647f9a3b3c76c_bf1272945b@iweiny-mobl.notmuch> (raw)
In-Reply-To: <SG2PR06MB339779C9F301585300B0B4DEB252A@SG2PR06MB3397.apcprd06.prod.outlook.com>

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.weiny@intel.com>
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> Reviewed-by: Fan Ni <fan.ni@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	other threads:[~2023-06-06 20:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-03  6:13 [PATCH 0/4] dax: Fix use after free and other cleanups Dan Williams
2023-06-03  6:13 ` [PATCH 1/4] dax: Fix dax_mapping_release() use after free Dan Williams
2023-06-04  2:40   ` Ira Weiny
2023-06-05 20:45   ` Fan Ni
2023-06-15 17:33   ` Dave Jiang
2023-06-03  6:13 ` [PATCH 2/4] dax: Use device_unregister() in unregister_dax_mapping() Dan Williams
2023-06-04  2:41   ` Ira Weiny
2023-06-05 20:46   ` Fan Ni
2023-06-15 17:34   ` Dave Jiang
2023-06-03  6:14 ` [PATCH 3/4] dax: Introduce alloc_dev_dax_id() Dan Williams
2023-06-04  2:57   ` Ira Weiny
2023-06-16  1:22     ` Dan Williams
2023-06-16 22:11       ` Ira Weiny
2023-06-03  6:14 ` [PATCH 4/4] dax: Cleanup extra dax_region references Dan Williams
2023-06-04  2:58   ` Ira Weiny
2023-06-06 17:46   ` Fan Ni
2023-06-06 20:42     ` Ira Weiny [this message]
2023-06-15 17:45   ` Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=647f9a3b3c76c_bf1272945b@iweiny-mobl.notmuch \
    --to=ira.weiny@intel.com \
    --cc=a.manzanares@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nifan@outlook.com \
    --cc=nmtadam.samsung@gmail.com \
    --cc=nvdimm@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox