From mboxrd@z Thu Jan 1 00:00:00 1970 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 B0908C433F5 for ; Mon, 27 Sep 2021 22:08:08 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41A5260F4F for ; Mon, 27 Sep 2021 22:08:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 41A5260F4F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HJGwk6ssyz3cjd for ; Tue, 28 Sep 2021 08:08:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qoP1G2/E; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=mcgrof@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qoP1G2/E; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HJGpM0wlGz2xsm for ; Tue, 28 Sep 2021 08:02:34 +1000 (AEST) 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=HyZ2KI/h/gpVdjlPSyGH7uhBE8wL3JrrLi6b2qQqvAU=; b=qoP1G2/EKd2PpB49LLfiUbqQI+ /p3qDXl4nBuY2BBqbAnV6/2x1xwiWeIlQnQLNSGlQBMjG3EumpQiGMlEbDPdE/sn6CJiZw384K1td MeXB7ScLURlgpF+SnAEZE1FVvYviEHHrDXd2QpWkTKyrKQ1+OghEj5vl1k4ABOpTO9GDr2E/T1I0h QsPVixF84kTYPzRMfC2dQ1p8QfG2KM6hfko6QbFW0GHU5d49mc8eGWwMKCMRZhRj3f+IAg7GziBYX fquh1PR0qgNEnoUNkUFFEHKi+dd/QaHU3XTv9ml3cZHGejdpvpc3CFWuoVv0PRV2ZLnWGdtGg/yLi bJVXGJDg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUyhC-004UJb-K1; Mon, 27 Sep 2021 22:01:58 +0000 From: Luis Chamberlain To: axboe@kernel.dk, bhelgaas@google.com, liushixin2@huawei.com, thunder.leizhen@huawei.com, lee.jones@linaro.org, geoff@infradead.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, jim@jtan.com, haris.iqbal@ionos.com, jinpu.wang@ionos.com, josh.h.morris@us.ibm.com, pjk1939@linux.ibm.com, tim@cyberelk.net, richard@nod.at, miquel.raynal@bootlin.com, vigneshr@ti.com Subject: [PATCH v2 07/10] block/sunvdc: add error handling support for add_disk() Date: Mon, 27 Sep 2021 15:01:54 -0700 Message-Id: <20210927220157.1069658-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210927220157.1069658-1-mcgrof@kernel.org> References: <20210927220157.1069658-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-block@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Luis Chamberlain , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. We re-use the same free tag call, so we also add a label for that as well. Signed-off-by: Luis Chamberlain --- drivers/block/sunvdc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 4d4bb810c2ae..6f45a53f7cbf 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -826,8 +826,8 @@ static int probe_disk(struct vdc_port *port) if (IS_ERR(g)) { printk(KERN_ERR PFX "%s: Could not allocate gendisk.\n", port->vio.name); - blk_mq_free_tag_set(&port->tag_set); - return PTR_ERR(g); + err = PTR_ERR(g); + goto out_free_tag; } port->disk = g; @@ -879,9 +879,17 @@ static int probe_disk(struct vdc_port *port) port->vdisk_size, (port->vdisk_size >> (20 - 9)), port->vio.ver.major, port->vio.ver.minor); - device_add_disk(&port->vio.vdev->dev, g, NULL); + err = device_add_disk(&port->vio.vdev->dev, g, NULL); + if (err) + goto out_cleanup_disk; return 0; + +out_cleanup_disk: + blk_cleanup_disk(g); +out_free_tag: + blk_mq_free_tag_set(&port->tag_set); + return err; } static struct ldc_channel_config vdc_ldc_cfg = { -- 2.30.2