Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1590318pxb; Fri, 27 Aug 2021 12:20:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd8PYa5A3Z4RKS5/T83HpBDd7rTJpGALcUk4hkY2v6dizdFWATJPTDjtNcUsu/pLO8RIr8 X-Received: by 2002:a02:93aa:: with SMTP id z39mr5723891jah.29.1630092051549; Fri, 27 Aug 2021 12:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630092051; cv=none; d=google.com; s=arc-20160816; b=qutx0fQm5/5PMipKdZkpqcZXGcO3QKGJ/rV5OrVhheSUGYl1c5K52XD+meAGRRBmDg gEwf5NARI0S08jU74DC/Znq0zzrGCUY0th81yBmpgVZQFidu4UIorwNBKylV2PQuiQPw 9kB4RuzrqR9ZDR4NFsHcfTxzVgL6xHXkdYKbM/SND3yOKgbiQ3HONShsXvPwKhAEQS5M NLOgjDzGG4yVtGAVSd4cpguD4A04jId4LFKwvQGW/O/b0ITSa5ghIkEBM0wBkJ1AVmgw oU4DB0LRhit36nO/WaOF4ALolEG24HxOTjaxcqcaFenB5JUjVgBLRp4R0GLYQNYT5gDx ueqw== 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=r8MzoKDcb67F6VDD0mCfQtUXlNELBrr58OK/skvQejQ=; b=ttnDS/Qdo7t+6jlGQdjgLreRrKCXwABO9C77FsJ/1VAdEGAda9yAlUyOVAAcdZiaz+ QZz/qt9J7+OuczuOsZ7eCY2jNsjtJjj4+AGm3yzRyYjVjFi2xl1nR7HAmjS66+6Fm+z/ fPlCq/BTyED7pit4g1dUkr8joxUkSdRczgBWPeETbqYxbZspRNW1ULfY9HA8W3kNxCSf tKkGqMCvshiD4v45eWl04QlyTzIZb1/rcmBELu4Uo+tXglx0DBAqjJWzaiT3McZRm9oI yIvFLUIqh4Y4mVtFIZHbHM7aQ5njCuiUoA+UnPxfSsscYUCgdubFWw0xzsH6Frx0MxGt UtiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="Q6aWwEC/"; 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 9si4576169jav.19.2021.08.27.12.20.40; Fri, 27 Aug 2021 12:20:51 -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="Q6aWwEC/"; 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 S230527AbhH0TTO (ORCPT + 99 others); Fri, 27 Aug 2021 15:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbhH0TTN (ORCPT ); Fri, 27 Aug 2021 15:19:13 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 957C3C061757; Fri, 27 Aug 2021 12:18:24 -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=r8MzoKDcb67F6VDD0mCfQtUXlNELBrr58OK/skvQejQ=; b=Q6aWwEC/JZVopdDk8X1QjnwL8l nn5puUdf+O7B1dgHvEgE4VR7dMiWkZu0xOHZ4JH821w52Q/zP3BGX87mxABarojvRRQN8u29TM7AL lR/nfcx0+N9/YXnOsFsLU4IceBFw2kFHhg0uy+/V1bVbKVTnYCfERNaqNWBnrCzFJCGtTrehA4gIX NsZ8WaFJYPNs/OBiDn26XCThBH4Eo/cEv0x9yrpI29bkfk1n34eDIt9vthtYt6S08SmmCC1MRMHhh KQw+8lZybK5CYUFuLfszXurf4AJk7ow675xAoVzGdkre1+NsJyA++7qavXURTiW5DAp++SVxfGZac b0ct+yrg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJhMh-00D5BG-Gk; 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 10/10] zram: add error handling support for add_disk() Date: Fri, 27 Aug 2021 12:18:09 -0700 Message-Id: <20210827191809.3118103-11-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/block/zram/zram_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index fcaf2750f68f..d5b343c2bc96 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1953,7 +1953,9 @@ static int zram_add(void) blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX); blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, zram->disk->queue); - device_add_disk(NULL, zram->disk, zram_disk_attr_groups); + ret = device_add_disk(NULL, zram->disk, zram_disk_attr_groups); + if (ret) + goto out_cleanup_disk; strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor)); @@ -1961,6 +1963,8 @@ static int zram_add(void) pr_info("Added device: %s\n", zram->disk->disk_name); return device_id; +out_cleanup_disk: + blk_cleanup_disk(zram->disk); out_free_idr: idr_remove(&zram_index_idr, device_id); out_free_dev: -- 2.30.2