Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4584433pxj; Wed, 12 May 2021 08:41:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywHpUyUT71stfulqDU62x1x2EDpPCGjCNgihrFKb6INjM1wWdU6d2KHRJTP6LHN0QooNSs X-Received: by 2002:a05:6402:40d6:: with SMTP id z22mr44494037edb.125.1620834085146; Wed, 12 May 2021 08:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834085; cv=none; d=google.com; s=arc-20160816; b=X7L32N7orZf2kF2RLvDaMZ/zKbqqLM7XEbLd2O74K4o1PvE6P342lAldB4ovbsaTX5 4tzvg4q/MpAQg6OkDxnOSY6v3vYWS8zLGC7KLp7nHSDNV4owkII01XV3abUspZBCUiAy of10HGCnHazrt/77LZA0dls4mnqcKprFcvaC1UOPwvwGQ0012WAP3SikcwIaWFfrk5fb s8TDNrpDolFWR5Wn90NdW35Ss3ne3hHD6qwoaEs6y1dAS+ZmC0py1RH4tE1rvU3fMZ+H qEbqXezMCDoWu+irOuaSsqw3Qqdw8/0q7Wnlx8gd0Mm2PvUTh9B4UfcPLxg8SMztMQWI uhfA== 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=0zOs12hzKvA/3A70hTaNNmikiWV4+oMxmvvmALxqtCQ=; b=Zuwgfe8HM5FSlpojJSVq4bj5wGLQlmA+UelOi7smqNZWzUUXqW7R2bFJgFCU+6FSnK FKnuPGDb/oB2FX9rILRH1Fjn/vjnJwc3wOK/P8VPICR11YEbrqvSugF/VyDaJSsQPDjm QIAASqH6LDGMO4h1Y8psNUk2+e4heG97erfjBm4+iybohIkDM0IDHrmApzfELZ4z7FbQ nVD5y0793Ue+YfUUHXD1iw0VFjYE63T5PSUxi5p6OqklaXIHqyJVeXzQQIXMtPbvHePb SC0Gj/T3nGtllxfz9OPYLGbdwdoET8fEfT2NCKYky11MAqywSIDv41oCMgnzdw5kXWZp 2d2g== 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 l23si356740ejb.573.2021.05.12.08.41.01; Wed, 12 May 2021 08:41:25 -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 S234342AbhELPj2 (ORCPT + 99 others); Wed, 12 May 2021 11:39:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:51870 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbhELPRB (ORCPT ); Wed, 12 May 2021 11:17:01 -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 CA3FDAF80; Wed, 12 May 2021 15:15:52 +0000 (UTC) Subject: Re: [PATCH v1 6/8] loop: 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-7-mcgrof@kernel.org> From: Hannes Reinecke Message-ID: <65f45d01-2f22-e7b9-1eb9-9055a7b483cd@suse.de> Date: Wed, 12 May 2021 17:15:52 +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-7-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/loop.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/block/loop.c b/drivers/block/loop.c > index d58d68f3c7cd..a22d8c985bf3 100644 > --- a/drivers/block/loop.c > +++ b/drivers/block/loop.c > @@ -2170,10 +2170,15 @@ static int loop_add(struct loop_device **l, int i) > disk->private_data = lo; > disk->queue = lo->lo_queue; > sprintf(disk->disk_name, "loop%d", i); > - add_disk(disk); > + err = add_disk(disk); > + if (err) > + goto out_put_disk; > + > *l = lo; > return lo->lo_number; > > +out_put_disk: > + put_disk(lo->lo_disk); > out_free_queue: > blk_cleanup_queue(lo->lo_queue); > out_cleanup_tags: > Reviewed-by: Hannes Reinecke 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