Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbdIKUPL (ORCPT ); Mon, 11 Sep 2017 16:15:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:45115 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751076AbdIKUPK (ORCPT ); Mon, 11 Sep 2017 16:15:10 -0400 Date: Mon, 11 Sep 2017 22:15:06 +0200 From: Jan Kara To: Christophe JAILLET Cc: axboe@fb.com, jack@suse.cz, tj@kernel.org, geliangtang@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()' Message-ID: <20170911201506.GA15044@quack2.suse.cz> References: <20170911194323.17833-1-christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170911194323.17833-1-christophe.jaillet@wanadoo.fr> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 895 Lines: 39 On Mon 11-09-17 21:43:23, Christophe JAILLET wrote: > If the 'kmalloc' fails, we must go through the existing error handling > path. > > Signed-off-by: Christophe JAILLET Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > mm/backing-dev.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/mm/backing-dev.c b/mm/backing-dev.c > index f028a9a472fd..e19606bb41a0 100644 > --- a/mm/backing-dev.c > +++ b/mm/backing-dev.c > @@ -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) > -- > 2.11.0 > -- Jan Kara SUSE Labs, CR