mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

If the 'kmalloc' fails, we must go through the existing error handling
path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Fixes: 52ebea749a ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christophe JAILLET 2017-09-11 21:43:23 +02:00 committed by Jens Axboe
parent 09c2c359be
commit 0b045bd1c1
1 changed files with 4 additions and 2 deletions

View File

@ -569,8 +569,10 @@ static int cgwb_create(struct backing_dev_info *bdi,
/* need to create a new one */
wb = kmalloc(sizeof(*wb), gfp);
if (!wb)
return -ENOMEM;
if (!wb) {
ret = -ENOMEM;
goto out_put;
}
ret = wb_init(wb, bdi, blkcg_css->id, gfp);
if (ret)