Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3937537pxb; Mon, 30 Aug 2021 14:29:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5x2e4Zx1NeczXC3PBgOyNiKy+io1qcIN4f1K5ZS7nCjH7LMH7nKtMj3VH2V1kIhT4xa7M X-Received: by 2002:a17:906:f20a:: with SMTP id gt10mr26375212ejb.487.1630358984489; Mon, 30 Aug 2021 14:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630358984; cv=none; d=google.com; s=arc-20160816; b=dAe+oZcPisb1v+R4dE5JdeJNNmVNgnX2kEgnbA8QvK5HPqQbv2F1zOsbrznRZDsnmM LhcHLk4G/MK3JqvKVo+ydkWci0viLRFgA+4ox8/dCoVyzsF7nYNMxzAPQ3gO1E3QBFXv hWgqq6tYGBYdA9EoDq8OXQvLeMU4sZ12z4dk2zgH9sBmsAfMTJ9rGFz7vLTF+gYbaVqf l7j8ieNwwZ99akENrzplJANJkx6PYaer/wPo9yG6cKm47X5Ry/yafavxQPYE6GWm1KST gz4W4Uhe+L2ljl/JErXVUoidG0xBBLGsc7ibsi9WYUyfXpzX0WGzuDER6Yv+8SrdtcLh Ueig== 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=+F5KOCzrXZghph/UppvQA2s1yRYbitmFgtgTDMNdZxo=; b=NWYjbQ7lwwnPqosdxnzGrEU7hTKU8OJobQ/gx0rPIgrRTD7AxF1KpULyUG9pcuHk1h K+on7BouujQlPneRgj/Qn2iFCsM1MBBYeC14M3OGaxdCxRXcE+67ScVOxAc1iEacW/uS dO+wSt65br/1owIqQ0vIkl1vfYtGIqkXfN5nfwmPfW6zK0HEquHhzYCWnp5ytYIE9snM ZFwxDKPxod6Vl0EqyKTuwSRIrQnct2ksKBv51103FIYdXiwoamx++rHaaHppsjizXQt/ geLaWvPVFqa9Dtb6ZWC4r/hUChBj0+iVZMAePZnBk2tOpzRG6P6xwZ9xZCeIjGRH7s+0 cObg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=g6G7Q57H; 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 mp36si17634248ejc.478.2021.08.30.14.29.21; Mon, 30 Aug 2021 14:29:44 -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=g6G7Q57H; 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 S238452AbhH3V1U (ORCPT + 99 others); Mon, 30 Aug 2021 17:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237560AbhH3V1E (ORCPT ); Mon, 30 Aug 2021 17:27:04 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F8AEC06175F; Mon, 30 Aug 2021 14:26:10 -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=+F5KOCzrXZghph/UppvQA2s1yRYbitmFgtgTDMNdZxo=; b=g6G7Q57H2FAHUqlaR9L+v6sDB0 WE9LESzO2ktJT4CDHl8/4lFV51UGHuWalXLANrTNskdjVAqbLeQcZ8MBM5huy4kZfbPTguKAY39AU zdgPFPVylW1iwCJY7LzzerYbclaC6mmBMfy+P8iZQ60pvo9t9fGi0oi+6sjeVz0vgJPxSWDfhZGew sd1RgARv+3wiYSr0ck6H0gtcFHWli8BiKHnTzw96sYEeXf0zgG+LAVDRvKxFG5Zt/B49B0GXm/O5b UPQYep4J2WSaDfiUeDgADxGkQmW71/HwXOmaPiU9LFTGiUhjnCkokGhH3pcKcJCXtuylp79lQqqHP 3AfVdnNw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKomk-000ci6-Fs; Mon, 30 Aug 2021 21:25:42 +0000 From: Luis Chamberlain To: axboe@kernel.dk, martin.petersen@oracle.com, jejb@linux.ibm.com, kbusch@kernel.org, sagi@grimberg.me, adrian.hunter@intel.com, beanhuo@micron.com, ulf.hansson@linaro.org, avri.altman@wdc.com, swboyd@chromium.org, agk@redhat.com, snitzer@redhat.com, josef@toxicpanda.com Cc: hch@infradead.org, hare@suse.de, bvanassche@acm.org, ming.lei@redhat.com, linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-mmc@vger.kernel.org, dm-devel@redhat.com, nbd@other.debian.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Chamberlain , Christoph Hellwig Subject: [PATCH v3 1/8] scsi/sd: add error handling support for add_disk() Date: Mon, 30 Aug 2021 14:25:31 -0700 Message-Id: <20210830212538.148729-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210830212538.148729-1-mcgrof@kernel.org> References: <20210830212538.148729-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. Reviewed-by: Christoph Hellwig Signed-off-by: Luis Chamberlain --- drivers/scsi/sd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 610ebba0d66e..8c1273fff23e 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3487,7 +3487,11 @@ static int sd_probe(struct device *dev) pm_runtime_set_autosuspend_delay(dev, sdp->host->hostt->rpm_autosuspend_delay); } - device_add_disk(dev, gd, NULL); + + error = device_add_disk(dev, gd, NULL); + if (error) + goto out_free_index; + if (sdkp->capacity) sd_dif_config_host(sdkp); -- 2.30.2