Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp962851pxb; Fri, 3 Sep 2021 18:50:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJEYza2EwvdXQdhZhZf8Fl0TfY6NMHwO0n24SjwBi7LxBB7s3iSQBzTSUAFR4Cyt2M1dx/ X-Received: by 2002:a17:906:8489:: with SMTP id m9mr1948404ejx.396.1630720258457; Fri, 03 Sep 2021 18:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630720258; cv=none; d=google.com; s=arc-20160816; b=I5GPs8fhQD1CHDUuiGTTISu+uisJy5bRO+OYSUdDWZ7lzWwkqk1EgKyxB9d+ie9W98 +u6JHHgEFXBE9MEpViqmoLbXYlRP6bZhgqyPp3t+ZeVL2WkhGAA4jCTIaYjiDJ+c7JTo /tpsX02sihgrh6qEjzJiPfsp5nish1Q/U9zSVC0DrZADcaRhSEHGsUbjruIoIO5Gxew2 RiPNb1aLqf47nlyLic9gW6WQvyPbOj9mxEhDWA8UOt6KtEQ9V2yI2a0eKAqqk2hOPebb kL/HZwxbM9W3fez6SQ3wiKZPPuMW3RjrckoypNPd0qgFDiMyeOPWc/iMlVM//zC/yj6H x+GA== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=emXHCsSESDsYXgDCyO6guaMlmVA/Vr3ZoS3mPS968XI=; b=QAaPLRQFEAB/yau4viglLBm0kM1aViOncIEs37CMyBNeWoEdqRq5Z3dNZcLerdhUBr M9HenESXtBMzOUvwRj4t/fX21DiDOzxaCjxlb4MuklqbEJU++AxC1owmcZ+D2zpwcoSK Su4NDN+KleLwiimLp7kRw9oiigQPwKfLNjs56LqjMntayv+c2dy1SVfvnUBh8L1RqfKN 6eOKnodElDAyRQ7tbNlmtnj5jsxWvLM4tSW2Gefwg/IHX89LcC7WJw8NNOUn71vdoSTe UHKxxLxB036zyPM1Ul9G1cDcUUokKMqypYoe/DZwW352gkkIEvqJal4ll3tm5aumbkci DA+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=c5XTnTtI; 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 n10si1565000edx.474.2021.09.03.18.50.35; Fri, 03 Sep 2021 18:50:58 -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=c5XTnTtI; 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 S1351203AbhIDBre (ORCPT + 99 others); Fri, 3 Sep 2021 21:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbhIDBre (ORCPT ); Fri, 3 Sep 2021 21:47:34 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F1F6C061575; Fri, 3 Sep 2021 18:46:33 -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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=emXHCsSESDsYXgDCyO6guaMlmVA/Vr3ZoS3mPS968XI=; b=c5XTnTtIW70QIk/iVIvzb87JqI tcT6qmY0efhEByu3yHG3p3VkkNGOyvSC3Qzi3Rn531DUP7oflNexg74DFSPZhSkjAQgPmwewphC/6 15RYnx5OSbnGFML3VcF08GO6poVHJBYxEXOeQKreYYZ9NeTiNb0KI81iI/KO1cvzX8bvKgRKPlNKI Mmmxhy4Zk6EV2DJEWS7sgmKTDPA5PFD17EJj3P3ozicrR5I23lkS3YoDhGa7fDEYz73HOICanJRmR OupJiQBNOPTq+2llAsgwuYjfz/JGKwLDBGSA+iLKuFjUFPnkEexHGj/Rb7QY1jlzJDg/fXmzl6DtQ AVXG3Iag==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMKlG-00DMId-9g; Sat, 04 Sep 2021 01:46:26 +0000 Date: Fri, 3 Sep 2021 18:46:26 -0700 From: Luis Chamberlain To: Heiko Carstens 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, hoeppner@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, Gerald Schaefer Subject: Re: [PATCH 7/9] s390/block/dcssblk: add error handling support for add_disk() Message-ID: References: <20210902174105.2418771-1-mcgrof@kernel.org> <20210902174105.2418771-8-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 03, 2021 at 04:08:48PM +0200, Heiko Carstens wrote: > On Thu, Sep 02, 2021 at 10:41:03AM -0700, 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/dcssblk.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c > > index 5be3d1c39a78..b0fd5009a12e 100644 > > --- a/drivers/s390/block/dcssblk.c > > +++ b/drivers/s390/block/dcssblk.c > > @@ -696,7 +696,9 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char > > } > > > > get_device(&dev_info->dev); > > - device_add_disk(&dev_info->dev, dev_info->gd, NULL); > > + rc = device_add_disk(&dev_info->dev, dev_info->gd, NULL); > > + if (rc) > > + goto put_dev; > > This looks not correct to me. We seem to have now in case of an error: > > - reference count imbalance (= memory leak) > - dax cleanup is missing Care to provide an alternative? Luis