diff mbox

[-next] rbd: fix error return code in rbd_dev_device_setup()

Message ID 1407977768-15119-1-git-send-email-weiyj_lk@163.com (mailing list archive)
State New, archived
Headers show

Commit Message

weiyj_lk@163.com Aug. 14, 2014, 12:56 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return -ENOMEM from the workqueue alloc error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/block/rbd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Alex Elder Aug. 14, 2014, 2:42 a.m. UTC | #1
On 08/13/2014 07:56 PM, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix to return -ENOMEM from the workqueue alloc error handling
> case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

This looks good to me.  Sorry I missed this when I first
reviewed the workqueue code.

Reviewed-by: Alex Elder <elder@linaro.org>


> ---
>   drivers/block/rbd.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 623c841..f3be022 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -5088,8 +5087,10 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
>   	set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
>
>   	rbd_dev->rq_wq = alloc_workqueue(rbd_dev->disk->disk_name, 0, 0);
> -	if (!rbd_dev->rq_wq)
> +	if (!rbd_dev->rq_wq) {
> +		ret = -ENOMEM;
>   		goto err_out_mapping;
> +	}
>
>   	ret = rbd_bus_add_dev(rbd_dev);
>   	if (ret)
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sage Weil Aug. 14, 2014, 3:50 a.m. UTC | #2
Applied.  Thanks!

On Wed, 13 Aug 2014, Alex Elder wrote:

> On 08/13/2014 07:56 PM, weiyj_lk@163.com wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > 
> > Fix to return -ENOMEM from the workqueue alloc error handling
> > case instead of 0, as done elsewhere in this function.
> > 
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> This looks good to me.  Sorry I missed this when I first
> reviewed the workqueue code.
> 
> Reviewed-by: Alex Elder <elder@linaro.org>
> 
> 
> > ---
> >   drivers/block/rbd.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> > index 623c841..f3be022 100644
> > --- a/drivers/block/rbd.c
> > +++ b/drivers/block/rbd.c
> > @@ -5088,8 +5087,10 @@ static int rbd_dev_device_setup(struct rbd_device
> > *rbd_dev)
> >   	set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
> > 
> >   	rbd_dev->rq_wq = alloc_workqueue(rbd_dev->disk->disk_name, 0, 0);
> > -	if (!rbd_dev->rq_wq)
> > +	if (!rbd_dev->rq_wq) {
> > +		ret = -ENOMEM;
> >   		goto err_out_mapping;
> > +	}
> > 
> >   	ret = rbd_bus_add_dev(rbd_dev);
> >   	if (ret)
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 623c841..f3be022 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5088,8 +5087,10 @@  static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
 	set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
 
 	rbd_dev->rq_wq = alloc_workqueue(rbd_dev->disk->disk_name, 0, 0);
-	if (!rbd_dev->rq_wq)
+	if (!rbd_dev->rq_wq) {
+		ret = -ENOMEM;
 		goto err_out_mapping;
+	}
 
 	ret = rbd_bus_add_dev(rbd_dev);
 	if (ret)