Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp228962pxb; Mon, 13 Sep 2021 17:45:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjldE/UgOgYgxCE5oO0WB2/Piy618x11s2EAAVowvylZxW2EzpXTBaj39HOs3I0HjXVWW9 X-Received: by 2002:a17:906:269a:: with SMTP id t26mr10941932ejc.20.1631580358360; Mon, 13 Sep 2021 17:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580358; cv=none; d=google.com; s=arc-20160816; b=Q9xf25RZZrygKNVmElW2Rso69lSmBvbZTE8UYpl9SYwLj0+h0ISTheyGotVdU6cyuA jMX2n1DriZ7ZrGNccgBgGwnKifcr/ZXy2ZPTHLQ7qBOFQFq1DDbuJNZ4WZ6YV/UjhVQM L16g+hY+zGEppd9OIFfYwHqK0NA0TXG9EtdCB3kTd/l8GOIx2QkIiQfxcrEYMABY/ItP JzE5xWNawBL24RPeIKfMx6vU48TUxSraYtXq9gou4GhpkBN915nbrijZOXtWjZ1MxUJV Amjd3717gKmofhSDQJGNzoCYN6ENQBdk6ZZdrhO32yYm6NdRJMOyMbUQdAMnWnQTulAH pfWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ozDu2C9KwJDzUHmqI8L8ZS+TLMmJ1vttUQXVZymGuXw=; b=rEGs2iti6JEpCIc1KRslwFpk2YFFHPQoCvi4qV00J05uP/XImUsRVdZPiYUkD6Ybh8 00D7RyVTPnO2xhckVLNLS5ALWGX3wqPmr5czC5YMZjOABF3ta0HlSGq+jYM7DRLSvEy4 AjGuRQuJw5YeT+I3zUFZyx70Cf3Cbg4jWV95CdmMWI+RS8Ooav4E6pZdg+vKs6GpQdK3 MCNR1Iq0rqx7oaoH4zfyb1oLry6vJOOc4mkaHu9F7HMfESo/rhJhrYsX10q1K5CCmgcZ Njtn3w2L4wd0ZyEHCoFugMRwwJn4H25bBIrpUjW5Tf/3UeL7EJZVPp8eV8LEfGg0p3Kd oqYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=luWWEIGy; 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 d23si8400670eds.175.2021.09.13.17.45.34; Mon, 13 Sep 2021 17:45:58 -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=luWWEIGy; 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 S237476AbhIMRXL (ORCPT + 99 others); Mon, 13 Sep 2021 13:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbhIMRXK (ORCPT ); Mon, 13 Sep 2021 13:23:10 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E9FC061574; Mon, 13 Sep 2021 10:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ozDu2C9KwJDzUHmqI8L8ZS+TLMmJ1vttUQXVZymGuXw=; b=luWWEIGyIZ+r8nBZzOJgzAJsGx N7oDNxgPF3OFmLGgbOPfFjf02fv1ISLc3zvjj4zwkR3ngVeDFoBg7Rkyv8mSPTvmKkXt7bSAXti/9 R9iY/fZEkesX3BRkVDPaUYhI5ZVJAmf9pJ9amuMKXN9I1A0qj9K6hB9CNHTxNXjZ4LiDoRa1aKw6u OUGwFvrmsqa3QOnqAltvdpvADc9fuLcHfFKdTOuFM26DVcVbWUL0CHsaQPCf1HTG5zJqz5CVqQ2VF UsurmMzg0xrJvEN2AiG/3SjuJJXUQG1qj45oxztVARgLk7FaNR9pDlE3SjbrPxclCpERbHXedjJr2 dSlpvPyQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPpe0-002eih-G4; Mon, 13 Sep 2021 17:21:24 +0000 Date: Mon, 13 Sep 2021 10:21:24 -0700 From: Luis Chamberlain To: Ming Lei Cc: 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, hch@infradead.org, hare@suse.de, bvanassche@acm.org, 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, Christoph Hellwig Subject: Re: [PATCH v3 1/8] scsi/sd: add error handling support for add_disk() Message-ID: References: <20210830212538.148729-1-mcgrof@kernel.org> <20210830212538.148729-2-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 07, 2021 at 09:29:07AM +0800, Ming Lei wrote: > On Mon, Aug 30, 2021 at 02:25:31PM -0700, 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. > > > > 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; > > + > > The error handling is actually wrong, see > > https://lore.kernel.org/linux-scsi/c93f3010-13c9-e07f-1458-b6b47a27057b@acm.org/T/#t > > Maybe you can base on that patch. Done, thanks! Luis