Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4215450pxj; Wed, 12 May 2021 00:03:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz26QswdppzKxbD9CeMTu3BBLdrPnJNVAkrTRfMl7I14VphccmiRSI50I3h+tElPsz3RSMv X-Received: by 2002:a05:6402:26ce:: with SMTP id x14mr40657631edd.216.1620803002260; Wed, 12 May 2021 00:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620803002; cv=none; d=google.com; s=arc-20160816; b=BRb7zKuL9Dtd6HoBqufWH651UBdlm1CMP7xvrE1bFx3eQjBLn4GCQ38IrVnrXlTd8/ 1yYKxg83+u+RH1nLpAm9hWGqED6mFmJ6KmZagema9SUFcy26cirtZp7qBfjKchbt88R1 MUuWHnys+x+obDk5sXP0veokaB0y0meIkQJ6Ep8CbWv7RbujcvYEbS5wxzOHFnxmMvPU gMSYM4M1YxuSewnWlbNQOpisiLKxg3rV4ykBaH3sP5taztvQZr/ljsUZuMzQ0Fl1B7uC E1ZNHowqIzMl+bt6ZDSSM/xcWE1akdSf1QFn3bny7u6Bl3vBApz21CnxcEDQOcFH5wYz Huug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rRvFdmtkNzHaWAB0nQVi9b7sIc+ospqDVc0cm2z7RwQ=; b=jB2W/TtzdXDalI8HGTveZ4Xny+qbCp5NGDUBZKjAwzPp8t7vIW0MIos0nHYCY/cINJ Z2c3XK/GMSwkHzz9qYAcogRwPt/C2NgxDF7/M/R4U3/GXVqhc2EcEypqnBhBpqmbAO6J mPJlgR3xPL4ntvLJnL/DAzP+WDnDgtGcpIAQ1CWtJTGh4OXOwrgzxX7aQahOWbZThJIQ k2J3RS8KimEGfdJf/+PhYj8kDHzM5bBa+AbAp68NRvttIV2fB6SRAlg91iT9d7e+oKzV LuVebG9X8O5dSlw2ckoOzjpPcd+H6EiHbOSflkGVlWly3JyMGaJrJny59Z+U7Uy3cRyC G5jQ== 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; 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 de20si18487601edb.211.2021.05.12.00.02.57; Wed, 12 May 2021 00:03:22 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbhELHDI (ORCPT + 99 others); Wed, 12 May 2021 03:03:08 -0400 Received: from mail-pl1-f171.google.com ([209.85.214.171]:33504 "EHLO mail-pl1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbhELHDI (ORCPT ); Wed, 12 May 2021 03:03:08 -0400 Received: by mail-pl1-f171.google.com with SMTP id b21so12075651plz.0; Wed, 12 May 2021 00:02:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rRvFdmtkNzHaWAB0nQVi9b7sIc+ospqDVc0cm2z7RwQ=; b=o1HLi2samwuYvQDpF9p7OEJnM4E2sTrX+zoFnSJynTDfJMDz2YfTHvELFruZDhoC84 QaBshc6KURrcQK6/DZ2GeI1ifJO9GNuSLUTcPfTgHOj9Y39mvuj2XKPr+wDT5pn+Inht DE5kaOL9SjuQlbYKom60kxDI8AnPLOVPGHrk1yVADNAw7hg5U7aZSp38aNl7ApLVh3en 0PPA6WM2rLPZdvzBYBYh6zz25ToFprFkBrbWyoIbQG7KS7WhSW2vEDt4cXM85aRZTAr8 KHKs9Qoq0hEm/V7VmdK9yNxCJZBDHvpQXSLCuoLZ8hcyLaNpHeIinMkMM91Fhkci0dWB TOYQ== X-Gm-Message-State: AOAM5320d7NyjBSP6sci7kTfzSn0jthiM4QTpAtSUQar9DbrJWlUE8Xp ARkZp+pAHFtSRlUMBir3Osk= X-Received: by 2002:a17:903:244:b029:ec:9666:9fc6 with SMTP id j4-20020a1709030244b02900ec96669fc6mr33657368plh.63.1620802919597; Wed, 12 May 2021 00:01:59 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id c195sm15186371pfb.5.2021.05.12.00.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 00:01:58 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 53A3642433; Wed, 12 May 2021 06:46:35 +0000 (UTC) From: Luis Chamberlain To: 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, Luis Chamberlain Subject: [PATCH v1 6/8] loop: add error handling support for add_disk() Date: Wed, 12 May 2021 06:46:27 +0000 Message-Id: <20210512064629.13899-7-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20210512064629.13899-1-mcgrof@kernel.org> References: <20210512064629.13899-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/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: -- 2.30.2