Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1589775pxb; Fri, 27 Aug 2021 12:19:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSruUvHPgJ6ommAhj5yF+/nDpt5Argvf89Y2b5S6/7FoGa6rdEQoFx5nbOmgjZ0EXUZtGl X-Received: by 2002:a92:cda4:: with SMTP id g4mr7853832ild.236.1630091998951; Fri, 27 Aug 2021 12:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630091998; cv=none; d=google.com; s=arc-20160816; b=A+tkdmEbLGq8D8TUSmGyNYzQ9ewA4dxrb8Qxzp5q96cn+Z219QT2DG4UtU13Ynd8YQ xsz4loaafjzRdLpP1HmMS82gQqLMuBYtpnHtDCM84JAhD3X+bctc3xKhJurf+HyrbMxu wYTjvWU0F6WUiKkwv+k61Sbnsdz6NLRDqGKzafK2b4lI4C6RbuFAH4bFBv+j1m/Dmfhs Vue8tlooN6+cRdt9zqNOLcS2ZlwjTZY9C5dVdq8l7jEWsWu8AG7uC7zKdfnX3+BrVb7W aPZ6xCTc3sMFY/XDF4MIxPVP0oecqCmeJIDd9qvg8znF+U+zRIxzJQ+IpaST61HrdR4r n2FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MlI7d0NX6/gbusr57eEjs+4gHr0mIPfbnhczoHLdvTU=; b=0lNuxNfAFrmg/hN7WgjCR0A3M/71B1cZA/fPcZp8JmgAAPJ5Yr5Gy8tGR4eSd9dmIC VoqNkcuVvuDpDVfPPhvghUARevIi1XD+OymEG5EMoJc8JnDX4TPBY4VDkbBlInMeowE3 yWD/JGeU3+wGBynuiXQdaZ9cT1jAbF8lV2FKMeeRmf6qZdGzhz2j3RPSu0XpF/ZvPTp6 oybdSASDJ/LT0WjRnuAbICDStuv0xTCKwMa0EzhxtY/XQrwnW1WWlsAX9e2U7c7mblvz BL1ozuR/dVUQdMnh93KFFNOqlGS7R67/WdJwcIZn68gqdpR0e81RnWcTjJCQMm4a1KYk kL0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=FiVuZjEe; 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 h9si7702229ils.85.2021.08.27.12.19.47; Fri, 27 Aug 2021 12:19: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=FiVuZjEe; 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 S231382AbhH0TT1 (ORCPT + 99 others); Fri, 27 Aug 2021 15:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbhH0TTO (ORCPT ); Fri, 27 Aug 2021 15:19:14 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE772C061757; Fri, 27 Aug 2021 12:18:25 -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=MlI7d0NX6/gbusr57eEjs+4gHr0mIPfbnhczoHLdvTU=; b=FiVuZjEeF4M9ZPaADvhCFh2tVN DYzuVOnQmxkB6JoMep8Nf6n0GlJbr2Q8vO49ziGqNHa6U7Oit5uXjxVqrkzljKd5V4BEzEEAUkUD6 YkPOGbzZDCekCv+riLl+K1iJzN5XsHP27b3OELPN4/xukR2OO/D0M/BfnulrdBkq6hBZbx5yvaWR8 jYpGUufJSWYUf92kagUPDE7vDOe+VuqHuiQQ+vWtf/BMkP8rZiEbfsWLqq+zspf5RTu1JOPpd0SDd pZexEgoIjJykLfRqUEO6XEGLamStM3CeBh+3o8KVyzA5W26cCP7v0d2MiCEfgKaU9kuR6jvDKuurb gNssezdw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJhMh-00D5B4-BH; Fri, 27 Aug 2021 19:18:11 +0000 From: Luis Chamberlain To: axboe@kernel.dk, colyli@suse.de, kent.overstreet@gmail.com, kbusch@kernel.org, sagi@grimberg.me, vishal.l.verma@intel.com, dan.j.williams@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, konrad.wilk@oracle.com, roger.pau@citrix.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org Cc: xen-devel@lists.xenproject.org, nvdimm@lists.linux.dev, linux-nvme@lists.infradead.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 06/10] nvdimm/btt: add error handling support for add_disk() Date: Fri, 27 Aug 2021 12:18:05 -0700 Message-Id: <20210827191809.3118103-7-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827191809.3118103-1-mcgrof@kernel.org> References: <20210827191809.3118103-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Signed-off-by: Luis Chamberlain --- drivers/nvdimm/btt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 275704d80109..abdac4b7769f 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -1542,7 +1542,9 @@ static int btt_blk_init(struct btt *btt) } set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); - device_add_disk(&btt->nd_btt->dev, btt->btt_disk, NULL); + rc = device_add_disk(&btt->nd_btt->dev, btt->btt_disk, NULL); + if (rc) + goto out_cleanup_disk; btt->nd_btt->size = btt->nlba * (u64)btt->sector_size; nvdimm_check_and_set_ro(btt->btt_disk); -- 2.30.2