Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4585556pxj; Wed, 12 May 2021 08:42:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJnwzSOVfAJh1leVQ64veRSzJekp6mLjbZ89KD8Lj5fSkoH/UQTCKMWbJaRm+ufuh7YCvo X-Received: by 2002:a4a:d4c7:: with SMTP id r7mr13082919oos.85.1620834168959; Wed, 12 May 2021 08:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834168; cv=none; d=google.com; s=arc-20160816; b=rdMvWOMZE/oBcCaSVi3SVZ5GLKU1gIzHpmMxkCt0NlAytOb72XR203Sx7T5zwnghUp RxDMhjUEzQ4fAGmcaoi4DBemEkDH0gBnfrf+OEiI3arOv4PXXdEI3tjemqaB+r5pTxYc P5lm+Wbr1CTBSLQ2gCiiMZUm7U9aS9wYsORd0mhYZ5r2SroJrpR5Gs7gFiKm8BA0B5tA HkPz8h/Xpr8Zz7fbINtav75EOVoj6TfBdU8tq4YGFFQkk6luKHhRombD1Ee8+DhAiibb tXLQIMbVWxIeSULCZY18ML4zu8n350kE7UJ74d9ig5EoaAxITkKw/kI0ENGW2pKgP+c0 YVsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=3OlSJQZwM4/8a1U1s121ASc9a4gYTdb59IK74d3fQ64=; b=NJxMqje4K9G76tm+YnbR6VnIMvzEBVqvrdrQCeAhug88C8I2tRoRLicKSfHt+AoMi+ +tiVoK3iYFzgAU1HrdwprmXM/j9nkIlw7rXDUoMDE0JCYo+ukBSoElW0rvUV+zaI9bF8 kmEkr0IPk7j+bl6WJvQrKLCK9i9ZQ+rAb2+NLj+cbYQb+f8JbCaTROgJ+x3jUCDyWW9U vnghhV78JgltQ9+qxbmcw3BSsxt8Awx7/DSLyy5wOZnR0qR9Y3aoo222kDJghC7RwTcM S9kEKE0gRbtkwNWe1RlAPQuYuR6uRNGtrS84wxpqp+3xnXsPPEw4kpZEy3yG9tqvfScm 7qdA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si217703oif.261.2021.05.12.08.42.34; Wed, 12 May 2021 08:42:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236476AbhELPki (ORCPT + 99 others); Wed, 12 May 2021 11:40:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:52552 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233254AbhELPRu (ORCPT ); Wed, 12 May 2021 11:17:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3242DB0B3; Wed, 12 May 2021 15:16:40 +0000 (UTC) Subject: Re: [PATCH v1 7/8] null_blk: add error handling support for add_disk() To: Luis Chamberlain , axboe@kernel.dk Cc: bvanassche@acm.org, ming.lei@redhat.com, hch@infradead.org, jack@suse.cz, osandov@fb.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210512064629.13899-1-mcgrof@kernel.org> <20210512064629.13899-8-mcgrof@kernel.org> From: Hannes Reinecke Message-ID: <842b6a8d-8880-a0da-a38b-39378dc6ebb9@suse.de> Date: Wed, 12 May 2021 17:16:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210512064629.13899-8-mcgrof@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/12/21 8:46 AM, Luis Chamberlain wrote: > 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/null_blk/main.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c > index 5f006d9e1472..2346d1292b26 100644 > --- a/drivers/block/null_blk/main.c > +++ b/drivers/block/null_blk/main.c > @@ -1699,6 +1699,7 @@ static int init_driver_queues(struct nullb *nullb) > > static int null_gendisk_register(struct nullb *nullb) > { > + int ret; > sector_t size = ((sector_t)nullb->dev->size * SZ_1M) >> SECTOR_SHIFT; > struct gendisk *disk; > > @@ -1719,13 +1720,17 @@ static int null_gendisk_register(struct nullb *nullb) > strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); > > if (nullb->dev->zoned) { > - int ret = null_register_zoned_dev(nullb); > + ret = null_register_zoned_dev(nullb); > > if (ret) > return ret; > } > > - add_disk(disk); > + ret = add_disk(disk); > + if (ret) { unregister_zoned_device() ? > + put_disk(disk); > + return ret; > + } > return 0; > } > > Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer