Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3012370pxb; Mon, 6 Sep 2021 10:12:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweKRfcyIVOdiSDDOioqGNtXRQZPf6yocx5xVgusZOefZ5Hn/Z28MRgKa87rXEU8yFoNtVI X-Received: by 2002:a05:6e02:928:: with SMTP id o8mr8243192ilt.37.1630948378157; Mon, 06 Sep 2021 10:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630948378; cv=none; d=google.com; s=arc-20160816; b=yljmGf6t+AkXqPirzC3ispSafqNfwWkPlP9GSoMaP/7ovfih5PDs3s7BVExI/Ox8pS 2/lyW4d4CEYTPZzuiJuHUTvDRADLL/yS1u0ApiKL621A7TxSJyoi28qv0XqLeKpz2jdM AE19ETfCJwqap66rp3A4R2PKSVM/FhnS2nt4L6c7dJNUWiTiwbBFSyyOhR5he29WqW0u jbGOBRT/CMnsjt1iYZ8pJNg+3JX/6J06xRabFKCIdAuYF3fAZCEUJJGyjqlOXwE5h3UV +FsrPsKZ3JzXeIoR3JDvWnIDjUORGBIVzPdZRn/5LntpoB/ux3EQCTFdA92Z+A37bblQ UJyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Cu2xJTqozk4xsbaxL8H9BoFzyGhonAhAaycqLOW0ec8=; b=v9ojwhP4S/v0zVwqK9dvUFjpT38+jegt8VXoL75m4l0cXwkZxm6eJkf2OEgdPhUuZ1 GSuoJWv2QypYk2IFba8QzxGTRvUcGHenzevYF4x2da5z30iUqCL322DbKrUOmI9oUe7p IFF1iZSI8lfWbz/8xmPDqZECu95SoR7xXmTNChvOQyS8qdPbal1LeTc8DMELiUBLXS8w BBNcwXSnM82q1akgtc+B/d7RdaQGGsxibRK9tXybgLBEstJnVtW5F0R0w3JS0Ct+9wR1 39x94MuxrveYuXqEgebrhyAKJhds5BAWd4PyvFFLdQp0meEJVlrvEvFBko5gRAJP00pk tBQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OlLhUgbA; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h199si7283193iof.50.2021.09.06.10.12.46; Mon, 06 Sep 2021 10:12: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=@linaro.org header.s=google header.b=OlLhUgbA; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243965AbhIFRMO (ORCPT + 99 others); Mon, 6 Sep 2021 13:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238964AbhIFRML (ORCPT ); Mon, 6 Sep 2021 13:12:11 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE598C06175F for ; Mon, 6 Sep 2021 10:11:05 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id s10so14493978lfr.11 for ; Mon, 06 Sep 2021 10:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cu2xJTqozk4xsbaxL8H9BoFzyGhonAhAaycqLOW0ec8=; b=OlLhUgbAfIRcaQBkm3ucc7CkjQAA3BY3foo15moLBOuI3bnD2Kus4MNZyf0QsYgIYo nYbwNGvkReFol2qerrmiIPhJwlB8yfL4VS7xERe6PQW1ZAkPROcukdDIAppf1FTAiEtW y+1oyCqSnc3RJ5wKu+lHo6J8Hhxb89KqfMf2R86r38NWDbRsmOlMpqbHkNHi7bCFiSqW cl3lahlfSxznPdky39hR5eu7x7LzmxY6PmVuGHoR2GG6KV3mnQh2ksxW1J/2m2kjXAZA AXoTX3K6GFv1heJQ79c2pUmD74HsC98NaYlHdj2R9LB8Mw6mkN6Kj8B5D6ZJn7udld5B OXKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Cu2xJTqozk4xsbaxL8H9BoFzyGhonAhAaycqLOW0ec8=; b=owkpbb9vBxEfdPRIJaKFoudG8RCEcJkh0LBrFClD8y0pG4uwmJnEI9807yv2WNM+GC 7riQPT75Mp8OVbkRJIXG6nBzQiV5kqjtdafH3ipN8x1fbb4Xl4SXImXpxrgParZlUr5I DKFPBEFqXye/ZeTFBc6ZNx3MCwZud0PRPtUCdrIoOsuaO8gSmzjhQK88/z64qxuchMeN hH8EeU8FC+Xaqaa13OWA6No/ei1ini8gjjzbDy4BaHvAu+MZGsUux0gILR3oMVCRulEu VCvQlVKTU+g8pkoX1hdyO9EJIgadpxT/f16qfYmFQyIMrTRKS4aMo/WhSq0tePZ4tDSX wqAA== X-Gm-Message-State: AOAM533EhgD4uBbJwfAz1BQG2i5SfYrrVHNVjczVGgzbtTM1zXvHGggF gedPKFEsm30+5Dumy09KFUmVG4eAQp2l7uhpSBRjcA== X-Received: by 2002:a05:6512:1043:: with SMTP id c3mr9631426lfb.358.1630948263963; Mon, 06 Sep 2021 10:11:03 -0700 (PDT) MIME-Version: 1.0 References: <20210902174105.2418771-1-mcgrof@kernel.org> <20210902174105.2418771-4-mcgrof@kernel.org> In-Reply-To: <20210902174105.2418771-4-mcgrof@kernel.org> From: Ulf Hansson Date: Mon, 6 Sep 2021 19:10:27 +0200 Message-ID: Subject: Re: [PATCH 3/9] mspro_block: add error handling support for add_disk() To: Luis Chamberlain Cc: Jens Axboe , Greg Kroah-Hartman , chaitanya.kulkarni@wdc.com, atulgopinathan@gmail.com, Hannes Reinecke , Maxim Levitsky , Alex Dubov , Colin King , Shubhankar Kuranagatti , Jia-Ju Bai , Tom Rix , dongsheng.yang@easystack.cn, ceph-devel@vger.kernel.org, Miquel Raynal , Richard Weinberger , Vignesh R , sth@linux.ibm.com, hoeppner@linux.ibm.com, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , oberpar@linux.ibm.com, Tejun Heo , linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org, linux-mmc , linux-block , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Sept 2021 at 19:41, 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. > > Contrary to the typical removal which delays the put_disk() > until later, since we are failing on a probe we immediately > put the disk on failure from add_disk by using > blk_cleanup_disk(). > > Signed-off-by: Luis Chamberlain Queued for v5.16 on the temporary devel branch, thanks! Kind regards Uffe > --- > drivers/memstick/core/mspro_block.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c > index 22778d0e24f5..c0450397b673 100644 > --- a/drivers/memstick/core/mspro_block.c > +++ b/drivers/memstick/core/mspro_block.c > @@ -1239,10 +1239,14 @@ static int mspro_block_init_disk(struct memstick_dev *card) > set_capacity(msb->disk, capacity); > dev_dbg(&card->dev, "capacity set %ld\n", capacity); > > - device_add_disk(&card->dev, msb->disk, NULL); > + rc = device_add_disk(&card->dev, msb->disk, NULL); > + if (rc) > + goto out_cleanup_disk; > msb->active = 1; > return 0; > > +out_cleanup_disk: > + blk_cleanup_disk(msb->disk); > out_free_tag_set: > blk_mq_free_tag_set(&msb->tag_set); > out_release_id: > -- > 2.30.2 >