From patchwork Wed Nov 3 23:04:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 12601829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B72C7C433EF for ; Wed, 3 Nov 2021 23:05:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 998A1611C6 for ; Wed, 3 Nov 2021 23:05:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbhKCXHc (ORCPT ); Wed, 3 Nov 2021 19:07:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230302AbhKCXH2 (ORCPT ); Wed, 3 Nov 2021 19:07:28 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E590EC061203; Wed, 3 Nov 2021 16:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=+G0HrywYCBknnU1QiNcJpSRJV8fKSVVdTBscrCYx8+A=; b=Zmqaf5rDkt5BDgJ7358IxzRO6L XYuL/LPlxrmXXxk6CReFpJeC8CNnR6Xn3GeW1dFC6BTz4AD5oGR8Z4KuSY2xHaMbnnYf5a24ruCVn wYIMvRI9O0ZU4aJfEliph7dDmGxH7oAJeL79U34TIrSuc5R4aY/cVXN0wbr25TvyTJ6pG7o0dne5g n5LDSiQOV5lMgrJsBcmtTBuFGY5pt3Nztn8i/eu7exI+yRg8nYPNBsMMyNA3EXAdAKYYS0VpeJE0j 8mmZfqCDJ4abGMYg1bWb8o+XEMJ5sLtOamvDK9PoixHGHji9J6SK0tP1eoMhlcQi/S/e7rF4P0HD9 6GBcHewQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1miPJ8-006seb-Og; Wed, 03 Nov 2021 23:04:38 +0000 From: Luis Chamberlain To: axboe@kernel.dk, hch@lst.de, penguin-kernel@i-love.sakura.ne.jp, dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, richard@nod.at, miquel.raynal@bootlin.com, vigneshr@ti.com, efremov@linux.com, song@kernel.org, martin.petersen@oracle.com, hare@suse.de, jack@suse.cz, ming.lei@redhat.com, tj@kernel.org, mcgrof@kernel.org Cc: linux-mtd@lists.infradead.org, linux-scsi@vger.kernel.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 09/14] mtd/ubi/block: add error handling support for add_disk() Date: Wed, 3 Nov 2021 16:04:32 -0700 Message-Id: <20211103230437.1639990-10-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211103230437.1639990-1-mcgrof@kernel.org> References: <20211103230437.1639990-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Reviewed-by: Christoph Hellwig Signed-off-by: Luis Chamberlain --- drivers/mtd/ubi/block.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index e003b4b44ffa..062e6c2c45f5 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -447,12 +447,18 @@ int ubiblock_create(struct ubi_volume_info *vi) list_add_tail(&dev->list, &ubiblock_devices); /* Must be the last step: anyone can call file ops from now on */ - add_disk(dev->gd); + ret = add_disk(dev->gd); + if (ret) + goto out_destroy_wq; + dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)", dev->ubi_num, dev->vol_id, vi->name); mutex_unlock(&devices_mutex); return 0; +out_destroy_wq: + list_del(&dev->list); + destroy_workqueue(dev->wq); out_remove_minor: idr_remove(&ubiblock_minor_idr, gd->first_minor); out_cleanup_disk: