Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp228339pxb; Mon, 13 Sep 2021 17:44:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlzFq+KyTZm94YGIe1jhCcrD/pakqvybTBm3a8dRUQil7ojecNmdTkX3uhd7HNxMa2Wsj3 X-Received: by 2002:a02:3f25:: with SMTP id d37mr6796040jaa.148.1631580294978; Mon, 13 Sep 2021 17:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580294; cv=none; d=google.com; s=arc-20160816; b=lf7mEvqYvS68JFYS/V6HJZ/njDGw8nZSFy+s8yx2eNiHj6tbgT+ueil6jBKDm+D4s8 HxA/+PHMrItZ0CM8s9dOvvh62V9Z4Uyc6UP+3GwDluK3io0tpVhpMc/Yqq7MQwG0yaad 2GzVnkNgytLeO1zz3P1sEs9GbDGXF1RYLWqk+NnnqTe4H/UbLgIDxkJ8tTUw4PNzvCLf p648lXuuv9XeEDwSCgtJ47KOJFW7QQp7gv5pm9oH0l289OzLz3DO20gcH/EEDujeCuW8 sQ1aAnifxEWjHVqtohpH+ab1EwvFXzhHNMz3elu7ZevJew5/8/oX8cJoP7qWiX1qbbuU /nJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xmhLMwi2AJDri4EtwlhDWcoIQUb7BB+muDOVcMR8vy0=; b=aGYHVynKchdtQVU+2O+90e4FRzmD/rccH1kRNVUqUUnSXCH1a8DRO/mIBbIP6VVG7R 3AoNewSYeFOX1Vaa35lOPvn29R5SS+aeHx0XkjpN3Z78XlbCW9X4cja12uW3rG/tWYbM AwU9sKESuVqGDOP9QaPx/MnvQY/SPcMPBBsPA+pfczyj7072xOPum7nAvOaD5Yx3b6cD c4vvM984w7nf3tn0dwCGahk1j3lYHRPgWk26X2ORMgvi3PlNcNbUE0m1lkjd1UYPPcEK oKxrrnczdeoJEDAXBKph+JQpONBYJITwfHxPuX9co7gBmp0cf6rdZAWR8kF8RQxBEyB1 FL3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=FtdyiSy0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si8233227ilu.60.2021.09.13.17.44.43; Mon, 13 Sep 2021 17:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=FtdyiSy0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240482AbhIMQxH (ORCPT + 99 others); Mon, 13 Sep 2021 12:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239727AbhIMQxD (ORCPT ); Mon, 13 Sep 2021 12:53:03 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D13C061762; Mon, 13 Sep 2021 09:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=xmhLMwi2AJDri4EtwlhDWcoIQUb7BB+muDOVcMR8vy0=; b=FtdyiSy0lblJ22JSsFNFEN1L0b Kwt5G/wmNlKaP8YypWTFbbQicWo49V0vpXWicsZU+tWZz2vY0q2BcJVNAB77Ex20OVrhlaanqGrsv GXmtK2DhdSHr43DUQ2GdkwFPcdZ3UMig7PIfr87L3rql+Xrxw0Pt3NVBdU3FvLJ9uWvOAgNcFURoT A5ymKEx6LOVi/hyhmccIOlZuueJDhGIajglMLQIMM1wZAQH53m/c9qN0AMXxRdQIRJ41U/IPBE47Z yLIk/KO0G0x9DLGCFPVaqR0PyVvc0OHPpVsKgjwrJUI6L798WFcddLaqIYM25nP2HjngygBfrQQHO cQM30FJg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPpBC-002WDJ-53; Mon, 13 Sep 2021 16:51:38 +0000 Date: Mon, 13 Sep 2021 09:51:38 -0700 From: Luis Chamberlain To: Jan =?iso-8859-1?Q?H=F6ppner?= Cc: axboe@kernel.dk, gregkh@linuxfoundation.org, chaitanya.kulkarni@wdc.com, atulgopinathan@gmail.com, hare@suse.de, maximlevitsky@gmail.com, oakad@yahoo.com, ulf.hansson@linaro.org, colin.king@canonical.com, shubhankarvk@gmail.com, baijiaju1990@gmail.com, trix@redhat.com, dongsheng.yang@easystack.cn, ceph-devel@vger.kernel.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, sth@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, oberpar@linux.ibm.com, tj@kernel.org, linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/9] s390/block/dasd_genhd: add error handling support for add_disk() Message-ID: References: <20210902174105.2418771-1-mcgrof@kernel.org> <20210902174105.2418771-7-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13, 2021 at 02:19:38PM +0200, Jan H?ppner wrote: > On 13/09/2021 10:17, Jan H?ppner wrote: > > On 02/09/2021 19:41, Luis Chamberlain wrote: > >> We never checked for errors on add_disk() as this function > >> returned void. Now that this is fixed, use the shiny new > >> error handling. > >> > >> Signed-off-by: Luis Chamberlain > >> --- > >> drivers/s390/block/dasd_genhd.c | 8 ++++++-- > >> 1 file changed, 6 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c > >> index fa966e0db6ca..ba07022283bc 100644 > >> --- a/drivers/s390/block/dasd_genhd.c > >> +++ b/drivers/s390/block/dasd_genhd.c > >> @@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block) > >> { > >> struct gendisk *gdp; > >> struct dasd_device *base; > >> - int len; > >> + int len, rc; > >> > >> /* Make sure the minor for this device exists. */ > >> base = block->base; > >> @@ -79,7 +79,11 @@ int dasd_gendisk_alloc(struct dasd_block *block) > >> dasd_add_link_to_gendisk(gdp, base); > >> block->gdp = gdp; > >> set_capacity(block->gdp, 0); > >> - device_add_disk(&base->cdev->dev, block->gdp, NULL); > >> + > >> + rc = device_add_disk(&base->cdev->dev, block->gdp, NULL); > >> + if (rc) > >> + return rc; > >> + > > > > I think, just like with some of the other changes, there is some > > cleanup required before returning. I'll prepare a patch and > > come back to you. > > > > It's actually just one call that is required. The patch should > look like this: > > diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c > index fa966e0db6ca..80673dbfb1f9 100644 > --- a/drivers/s390/block/dasd_genhd.c > +++ b/drivers/s390/block/dasd_genhd.c > @@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block) > { > struct gendisk *gdp; > struct dasd_device *base; > - int len; > + int len, rc; > > /* Make sure the minor for this device exists. */ > base = block->base; > @@ -79,7 +79,13 @@ int dasd_gendisk_alloc(struct dasd_block *block) > dasd_add_link_to_gendisk(gdp, base); > block->gdp = gdp; > set_capacity(block->gdp, 0); > - device_add_disk(&base->cdev->dev, block->gdp, NULL); > + > + rc = device_add_disk(&base->cdev->dev, block->gdp, NULL); > + if (rc) { > + dasd_gendisk_free(block); > + return rc; > + } > + Thanks! Would you like to to fold this fix into my patch and resend eventually? Or will you send a replacement? Luis