Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3940467pxb; Mon, 30 Aug 2021 14:31:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfexU/Lk0PSSM3bQPl2hN9x9ZlnqJoh1j4s9A78mT5vD+Hx+it0EnZKMus4EZ1j/T1jzB1 X-Received: by 2002:a05:6402:10d9:: with SMTP id p25mr25631891edu.51.1630359103941; Mon, 30 Aug 2021 14:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630359103; cv=none; d=google.com; s=arc-20160816; b=CWO9OMDac3dGF3YH6z7lQL9a24hsc9XNo4FVE0RNk0CzZ1xoB0a0irdUlexuiIONmB BS3lw9fR+tb3CbioHomn+XPSEHu8wsP1zFOiSRAdZPN0eZUZoMJkIDtQeIU4IzUybw8n XUr3vk6j4X4vwAzTYhVRIng2JD10SOgB0qelN9wzHy0tNluxgMzlG+cggsj39KXjPhvG /l52UeAoozISqOS+ywgi224dmVruH2o6qWfN+G5AGT8DjP782RuR6XtzWMlKcT4ahoWz kL1k8xe5HVXLxGuQwiq1UnDcm+Ht9kcisyz3hNdLFq76c/UuaB0fLls0r02eIH2WI7xz 6trg== 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=vjDH1jMfJBrZv4rfw/hLobkpUNKwZF7oRRD315NfMik=; b=hhJSYnX3bjR7cxumifu4Xei86DcUDZs+JHrNOrwbg0Wnu4RI0jCR3PCfofuFLURgt2 Bm9Do4LsLRAh2cbti7H8O97W9GgX6rvpDB6uIMVvU/TwZFNh8g2pzdz8jXmBGV+U1ouS 3XXg8b3F2j07nQtd0P8NCjWgLw+iKCwEljGXtGBvvYfWXylouwfcPwyIL2bl/bpfzBK6 ShU/xhADy1JFNyIkqfVRRE28sdniravyB5WFeGeuuVGKdkhrD0V3SVNIbPvdD9YIqK+J vsXQ01dn/sey7v57bETNXguoE1BJUr6f1/Y6B2I8PHxyw0nZZqSXKy+xkzOLuMzjp2Q5 R7AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=tfundgQK; 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 k7si15506558ejo.10.2021.08.30.14.31.19; Mon, 30 Aug 2021 14:31:43 -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=tfundgQK; 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 S238195AbhH3V2O (ORCPT + 99 others); Mon, 30 Aug 2021 17:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237713AbhH3V1I (ORCPT ); Mon, 30 Aug 2021 17:27:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C660FC0617AD; Mon, 30 Aug 2021 14:26:13 -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=vjDH1jMfJBrZv4rfw/hLobkpUNKwZF7oRRD315NfMik=; b=tfundgQK1SDY1fknDZJQYjpNpg G1u4zzvbx1lH1ZSdjg08TCZpWXYwpKjbJN1LiDBgV8JotCGz6zuzU67qTKg5HiVO9KaX9vrarVgjd mFDIxg2LKMxqDgHNV46zgFdSIPFVD9VkcWX1ThxsVN/E3HVzeBQEtvmdG0IgOUXGpXuPhW6yMDGAl SC4ZBe9inzp2bmYF6StOwXF7JnuIyy/AWmezhayFvA71s40WOw6Ba8HAqtZdiCuXmCjf5cqEu+tWa Th1p3POR6SFxhrjMgWymCr4T2+vn8UmCmi8gmv8TqsmpS48rg9iEjYeLvPN+kbIyYN9EnxPoRa9f0 J3yEYavw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKomk-000ci8-IK; 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 2/8] scsi/sr: add error handling support for add_disk() Date: Mon, 30 Aug 2021 14:25:32 -0700 Message-Id: <20210830212538.148729-3-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/sr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 2942a4ec9bdd..72fd21844367 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -779,7 +779,10 @@ static int sr_probe(struct device *dev) dev_set_drvdata(dev, cd); disk->flags |= GENHD_FL_REMOVABLE; sr_revalidate_disk(cd); - device_add_disk(&sdev->sdev_gendev, disk, NULL); + + error = device_add_disk(&sdev->sdev_gendev, disk, NULL); + if (error) + goto fail_minor; sdev_printk(KERN_DEBUG, sdev, "Attached scsi CD-ROM %s\n", cd->cdi.name); -- 2.30.2