Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396507 > unrolled thread

[PATCH 1/7] libnvdimm: cleanup nvdimm_namespace_common_probe(), kill 'host'

Started byDan Williams <dan.j.williams@intel.com>
First post2016-05-09 00:40 +0200
Last post2016-05-09 10:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/7] libnvdimm: cleanup nvdimm_namespace_common_probe(),  kill 'host' Dan Williams <dan.j.williams@intel.com> - 2016-05-09 00:40 +0200
    Re: [PATCH 1/7] libnvdimm: cleanup nvdimm_namespace_common_probe(),  kill 'host' Johannes Thumshirn <jthmshirn@suse.de> - 2016-05-09 10:00 +0200

#1396507 — [PATCH 1/7] libnvdimm: cleanup nvdimm_namespace_common_probe(), kill 'host'

FromDan Williams <dan.j.williams@intel.com>
Date2016-05-09 00:40 +0200
Subject[PATCH 1/7] libnvdimm: cleanup nvdimm_namespace_common_probe(), kill 'host'
Message-ID<rwFwJ-7k9-7@gated-at.bofh.it>
The 'host' variable can be killed as it is always the same as the passed
in device.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/namespace_devs.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index f5cb88601359..e5ad5162bf34 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -1379,21 +1379,16 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
 {
 	struct nd_btt *nd_btt = is_nd_btt(dev) ? to_nd_btt(dev) : NULL;
 	struct nd_pfn *nd_pfn = is_nd_pfn(dev) ? to_nd_pfn(dev) : NULL;
-	struct nd_namespace_common *ndns;
+	struct nd_namespace_common *ndns = NULL;
 	resource_size_t size;
 
 	if (nd_btt || nd_pfn) {
-		struct device *host = NULL;
-
-		if (nd_btt) {
-			host = &nd_btt->dev;
+		if (nd_btt)
 			ndns = nd_btt->ndns;
-		} else if (nd_pfn) {
-			host = &nd_pfn->dev;
+		else if (nd_pfn)
 			ndns = nd_pfn->ndns;
-		}
 
-		if (!ndns || !host)
+		if (!ndns)
 			return ERR_PTR(-ENODEV);
 
 		/*
@@ -1404,12 +1399,12 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
 		device_unlock(&ndns->dev);
 		if (ndns->dev.driver) {
 			dev_dbg(&ndns->dev, "is active, can't bind %s\n",
-					dev_name(host));
+					dev_name(dev));
 			return ERR_PTR(-EBUSY);
 		}
-		if (dev_WARN_ONCE(&ndns->dev, ndns->claim != host,
+		if (dev_WARN_ONCE(&ndns->dev, ndns->claim != dev,
 					"host (%s) vs claim (%s) mismatch\n",
-					dev_name(host),
+					dev_name(dev),
 					dev_name(ndns->claim)))
 			return ERR_PTR(-ENXIO);
 	} else {

[toc] | [next] | [standalone]


#1396808

FromJohannes Thumshirn <jthmshirn@suse.de>
Date2016-05-09 10:00 +0200
Message-ID<rwOgH-II-31@gated-at.bofh.it>
In reply to#1396507
On Sun, May 08, 2016 at 03:35:15PM -0700, Dan Williams wrote:
> The 'host' variable can be killed as it is always the same as the passed
> in device.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web