Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp596947pxb; Thu, 2 Sep 2021 10:45:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHKXgXN3JDl2775yN4aXNiiRMuKV5FygiJALM5x+ZnR/1d2Rz9dBwf1q4T0MTL/itkfLN2 X-Received: by 2002:a5d:87d2:: with SMTP id q18mr3788676ios.78.1630604708121; Thu, 02 Sep 2021 10:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630604708; cv=none; d=google.com; s=arc-20160816; b=hBRVa5JEzLRniuyPuDGjh64gI+taLCgzOg+W+lqqgBXvpyswNUI1p+PeTpgVOy4yUh OKezWdiLWJD3YZh2xDqMktpz1wKEMHOcjEac8YIgNpYXnWOtwdzDfMwmH05ilK2ulZ64 yyjIVHNBHNrmnxxhNr5mJVmI6wgL8SJuuzCnlqrCV2dObLVJPjGWn+Z5zHRLKbaUaz0b tKDdfOWxMP3Q7WnfQn1zobHlIHUaiwSFJ/sY34fqgcyS7Fd9SuVKXVu0+5QHeW9DB95n ULdwYCCFZssssaV5W4uX7B/8OTPnevkB6zf88MoPJLqEmO+VWq78MhFihypvH8hHxirx Mu6Q== 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=m46K19zqMpohOFZJ7xRAzdG17R75/WCRRoDdwcwdSMI=; b=K/yZ/Tx9F7A4l/2+O7NjEb3l8V9BPQVD8jbziThK2OfnP+NPK7Ug4iRYiA/vPxb47T VyvkfdFTPZdbxiJw5Hk3rKjxaK6+QqWlNzIZmXZjtNFfATQsO6MgoV2nwr1DVaoW5K/T HaETJe8KLKPFEY6Jfb7jGxezt1CI+Z9TfO1qq3PzMi+fBKaf+GjyxcvaVr0WW0V0mLC2 7lqtScG8XYoDVkS7z4dwbjsiJmp4YmEJ0LLs+cZcqHXIYkxD3iMHrZPfNICl9xnL5s+V kw2RfeJwHj4/HuaOn3Arw5A3Hys15qq5GSUly0OLN8kPMo3QqToMS8NtaH5x7dQNXxGc g9qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=nGsfDA0F; 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 b16si2916313ilf.63.2021.09.02.10.44.37; Thu, 02 Sep 2021 10:45:08 -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=nGsfDA0F; 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 S1347053AbhIBRmk (ORCPT + 99 others); Thu, 2 Sep 2021 13:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347023AbhIBRmU (ORCPT ); Thu, 2 Sep 2021 13:42:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC89BC061575; Thu, 2 Sep 2021 10:41:21 -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=m46K19zqMpohOFZJ7xRAzdG17R75/WCRRoDdwcwdSMI=; b=nGsfDA0FoN9p02CmwlLLtE/j5O onQNmJ7WjpnucJfBj4/6zRGMVSHMnWTMoxJPRz/uz/kJpJeESHsHO33Gj/jldk92HuaOfobXhfHrp /uNJMJe+oV8CLgCYZPgbU9f/0iZjsabR3dpuHpYdMc0JWVXRXFzFGmh6nXf1RCtfaCqK7IZLRRC7b 1qCyvjhUzLZQe4zXn2gLZnsxjdgSbxtH4fbTLKmEUCTGwNjl6nHj65OIbzHhP5Zm/XAA347ahLQhM CjfFSpqKjjGCIYQo7g0ptAFBAvDPwvRaW8vpg82U23YvpkgLZvQrpn9P9T00KijCg78bCy6OHFabn sgDF1Ewg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLqi2-00A9FK-36; Thu, 02 Sep 2021 17:41:06 +0000 From: Luis Chamberlain To: 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, hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, oberpar@linux.ibm.com, tj@kernel.org Cc: 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, Luis Chamberlain Subject: [PATCH 5/9] mtd: add add_disk() error handling Date: Thu, 2 Sep 2021 10:41:01 -0700 Message-Id: <20210902174105.2418771-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210902174105.2418771-1-mcgrof@kernel.org> References: <20210902174105.2418771-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/mtd/mtd_blkdevs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 44bea3f65060..343ff96589cc 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -427,7 +427,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) if (new->readonly) set_disk_ro(gd, 1); - device_add_disk(&new->mtd->dev, gd, NULL); + ret = device_add_disk(&new->mtd->dev, gd, NULL); + if (ret) + goto out_cleanup_disk; if (new->disk_attributes) { ret = sysfs_create_group(&disk_to_dev(gd)->kobj, @@ -436,6 +438,8 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) } return 0; +out_cleanup_disk: + blk_cleanup_disk(new->disk); out_free_tag_set: blk_mq_free_tag_set(new->tag_set); out_kfree_tag_set: -- 2.30.2