From patchwork Fri Aug 27 19:18:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 12462841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D79C4320A for ; Fri, 27 Aug 2021 20:12:44 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 5E4E560EFF for ; Fri, 27 Aug 2021 20:12:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5E4E560EFF 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.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.173937.317326 (Exim 4.92) (envelope-from ) id 1mJiDB-0007t9-5z; Fri, 27 Aug 2021 20:12:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 173937.317326; Fri, 27 Aug 2021 20:12:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mJiDB-0007t2-2T; Fri, 27 Aug 2021 20:12:25 +0000 Received: by outflank-mailman (input) for mailman id 173937; Fri, 27 Aug 2021 19:18:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mJhMu-0001H3-EZ for xen-devel@lists.xenproject.org; Fri, 27 Aug 2021 19:18:25 +0000 Received: from bombadil.infradead.org (unknown [2607:7c80:54:e::133]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3d9ddd8e-9c8c-4b5c-9b9e-3371a58e3267; Fri, 27 Aug 2021 19:18:22 +0000 (UTC) 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 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 3d9ddd8e-9c8c-4b5c-9b9e-3371a58e3267 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==; 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 Sender: Luis Chamberlain 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: