libnvdimm, bus: check id immediately following ida_simple_get
diff mbox series

Message ID 1533298113-17495-1-git-send-email-oceanhehy@gmail.com
State Accepted
Commit 9bf3aa44644721b287724ecac835d38f1dae4e2d
Headers show
Series
  • libnvdimm, bus: check id immediately following ida_simple_get
Related show

Commit Message

Ocean He Aug. 3, 2018, 12:08 p.m. UTC
From: Ocean He <hehy1@lenovo.com>

The id check was not executed immediately following ida_simple_get. Just
change the codes position, without function change.

Signed-off-by: Ocean He <hehy1@lenovo.com>
---
 drivers/nvdimm/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Verma, Vishal L Aug. 3, 2018, 5:13 p.m. UTC | #1
On Fri, 2018-08-03 at 08:08 -0400, Ocean He wrote:
> From: Ocean He <hehy1@lenovo.com>
> 
> The id check was not executed immediately following ida_simple_get.
> Just
> change the codes position, without function change.
> 
> Signed-off-by: Ocean He <hehy1@lenovo.com>
> ---
>  drivers/nvdimm/bus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Looks good, feel free to add
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index 27902a8..ab28e7c 100644
> --- a/drivers/nvdimm/bus.c
> +++ b/drivers/nvdimm/bus.c
> @@ -350,12 +350,12 @@ struct nvdimm_bus *nvdimm_bus_register(struct
> device *parent,
>  	INIT_LIST_HEAD(&nvdimm_bus->mapping_list);
>  	init_waitqueue_head(&nvdimm_bus->probe_wait);
>  	nvdimm_bus->id = ida_simple_get(&nd_ida, 0, 0, GFP_KERNEL);
> -	mutex_init(&nvdimm_bus->reconfig_mutex);
> -	badrange_init(&nvdimm_bus->badrange);
>  	if (nvdimm_bus->id < 0) {
>  		kfree(nvdimm_bus);
>  		return NULL;
>  	}
> +	mutex_init(&nvdimm_bus->reconfig_mutex);
> +	badrange_init(&nvdimm_bus->badrange);
>  	nvdimm_bus->nd_desc = nd_desc;
>  	nvdimm_bus->dev.parent = parent;
>  	nvdimm_bus->dev.release = nvdimm_bus_release;
Dave Jiang Aug. 7, 2018, 10:46 p.m. UTC | #2
On 08/03/2018 05:08 AM, Ocean He wrote:
> From: Ocean He <hehy1@lenovo.com>
> 
> The id check was not executed immediately following ida_simple_get. Just
> change the codes position, without function change.
> 
> Signed-off-by: Ocean He <hehy1@lenovo.com>

Applied.

> ---
>  drivers/nvdimm/bus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index 27902a8..ab28e7c 100644
> --- a/drivers/nvdimm/bus.c
> +++ b/drivers/nvdimm/bus.c
> @@ -350,12 +350,12 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
>  	INIT_LIST_HEAD(&nvdimm_bus->mapping_list);
>  	init_waitqueue_head(&nvdimm_bus->probe_wait);
>  	nvdimm_bus->id = ida_simple_get(&nd_ida, 0, 0, GFP_KERNEL);
> -	mutex_init(&nvdimm_bus->reconfig_mutex);
> -	badrange_init(&nvdimm_bus->badrange);
>  	if (nvdimm_bus->id < 0) {
>  		kfree(nvdimm_bus);
>  		return NULL;
>  	}
> +	mutex_init(&nvdimm_bus->reconfig_mutex);
> +	badrange_init(&nvdimm_bus->badrange);
>  	nvdimm_bus->nd_desc = nd_desc;
>  	nvdimm_bus->dev.parent = parent;
>  	nvdimm_bus->dev.release = nvdimm_bus_release;
>

Patch
diff mbox series

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 27902a8..ab28e7c 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -350,12 +350,12 @@  struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
 	INIT_LIST_HEAD(&nvdimm_bus->mapping_list);
 	init_waitqueue_head(&nvdimm_bus->probe_wait);
 	nvdimm_bus->id = ida_simple_get(&nd_ida, 0, 0, GFP_KERNEL);
-	mutex_init(&nvdimm_bus->reconfig_mutex);
-	badrange_init(&nvdimm_bus->badrange);
 	if (nvdimm_bus->id < 0) {
 		kfree(nvdimm_bus);
 		return NULL;
 	}
+	mutex_init(&nvdimm_bus->reconfig_mutex);
+	badrange_init(&nvdimm_bus->badrange);
 	nvdimm_bus->nd_desc = nd_desc;
 	nvdimm_bus->dev.parent = parent;
 	nvdimm_bus->dev.release = nvdimm_bus_release;