Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3313653pxb; Mon, 6 Sep 2021 18:31:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi7NX5+Cw8qbMLNjQZRlMOkT1Xchl57wAcvInJT0emQhS8QorJZJ7Ugb+y+7tcgDabErCO X-Received: by 2002:a05:6602:1845:: with SMTP id d5mr11674454ioi.23.1630978287690; Mon, 06 Sep 2021 18:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630978287; cv=none; d=google.com; s=arc-20160816; b=RjoLcGh9/uqnShPdOl8z9ryzl1acJ85eyPiETABYFaV+TDs76Puwz40SZ2n/9GtQ8f G23qTXRuWAElN6oJV4ARujDe1180qnjXVVoRd0DGmLrHqtrk2Mbo7EJ1pWyzOzTp8mKs kb0mhzJ/odOcmarSa34MWVT8EoYEu2jTou1LtdzyJqlI2yZGDZatW+hEeQyxhEgIPQfu PEsZEhkAxkMg2Xmq4RTpibxDkZdq4bi8NGn1bvBm+1p+tD5nzoPr3a1fEXjwUaT9oAd9 gZne1TaT7RdI3Cn09wSbRilq/Lh06sBqeynhnSC0rOhHDvIqw8ndJ5CCR+vk8lOLsgtA 935Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TKgDvqKCjC/sEBRel6+SL/8u4J2HhIt06zHYphh9H0o=; b=NSbqQ1US8PoQPB7DItT4PvK/wqzGfQdLyA3NZjLDRyVQfG5V0XLlY//MAVB7O7ekDA q5wGsjMHP0ghhM6ZjWgs3ryqJAJyJMmsd5fUtavJI1xVZqHTyiqnhwTAbZBEU0Sd3RTN nhZBn1uri13TKIHXPUTiDSTawRaQ0om7Jbd5FKlO0Kap1MNJShh538wfXezDAZbCXm1Y W9xQ55pR217bplBocqmjRKZaFzEqXmq/NZ4micDyDb9zJy4T8ycrKESUxd4x0jdbZwvt VuMPRQIPWukAhQ31uyJn1hM0b77I+oHT9UofX1oyJ3yVG/cEu39kZN5gfhXCqC1cg5Ts l56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="X70lgC/0"; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si9772342iow.85.2021.09.06.18.31.16; Mon, 06 Sep 2021 18:31:27 -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=@redhat.com header.s=mimecast20190719 header.b="X70lgC/0"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232705AbhIGBaj (ORCPT + 99 others); Mon, 6 Sep 2021 21:30:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25521 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232724AbhIGBaj (ORCPT ); Mon, 6 Sep 2021 21:30:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630978173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TKgDvqKCjC/sEBRel6+SL/8u4J2HhIt06zHYphh9H0o=; b=X70lgC/0/cpzFAuP7TSbx34A0SIAYhPSCifCICENEDI+AD3ZRJtYWC7llRutiSJcvn5l9x Cyz9/uIUpi0wsB+AZqlOiWI5XMqxGCYmQBefclwC3XuYs/XqnIoTodhzhdNemvRcT5/Bh8 AGZtzv+msqfDeYKx/xdXKdH5f0Wpp18= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-E4mwGRf4NEamNRpPjMFLvQ-1; Mon, 06 Sep 2021 21:29:32 -0400 X-MC-Unique: E4mwGRf4NEamNRpPjMFLvQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0326A80124F; Tue, 7 Sep 2021 01:29:29 +0000 (UTC) Received: from T590 (ovpn-8-23.pek2.redhat.com [10.72.8.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B103271B3; Tue, 7 Sep 2021 01:29:06 +0000 (UTC) Date: Tue, 7 Sep 2021 09:29:07 +0800 From: Ming Lei To: Luis Chamberlain 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: <20210830212538.148729-2-mcgrof@kernel.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Ming