From patchwork Sat Apr 15 18:55:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9682405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99DB560138 for ; Sat, 15 Apr 2017 19:00:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A5822846F for ; Sat, 15 Apr 2017 19:00:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EAAE28477; Sat, 15 Apr 2017 19:00:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C86F72846F for ; Sat, 15 Apr 2017 19:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755989AbdDOTAI (ORCPT ); Sat, 15 Apr 2017 15:00:08 -0400 Received: from mail-dm3nam03on0041.outbound.protection.outlook.com ([104.47.41.41]:38016 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755101AbdDOS4b (ORCPT ); Sat, 15 Apr 2017 14:56:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=N81sKdo5XZu3D7MWrI3qIV2pzuz06jCE+L100O4XRww=; b=D+sh6ebeIWXdc1P9WOW2gfuO1Z+r6sHYsGh+8y1j9KbUYL+/pXPdokHn3TdTHjh7Y0AdsAcyzqfxg6/OjGqGtg1jHoBLK2OVPnwYnqbw5b6+WKsljdKp8qIl+suUlD/ixaVoZePzeHeVIAHwXLycL6U6GzqU/Ur7U7bRV8pjXAg= Authentication-Results: fb.com; dkim=none (message not signed) header.d=none; fb.com; dmarc=none action=none header.from=cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by CY4PR06MB2774.namprd06.prod.outlook.com (10.175.117.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Sat, 15 Apr 2017 18:56:24 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 09/19] lightnvm: fix cleanup order of disk on init error Date: Sat, 15 Apr 2017 20:55:43 +0200 Message-ID: <20170415185553.16098-10-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170415185553.16098-1-matias@cnexlabs.com> References: <20170415185553.16098-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: AM5PR0701CA0069.eurprd07.prod.outlook.com (10.169.145.159) To CY4PR06MB2774.namprd06.prod.outlook.com (10.175.117.142) X-MS-Office365-Filtering-Correlation-Id: f6276898-518d-4757-a47c-08d484311dfd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY4PR06MB2774; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 3:2l5nahr8H8kv+W6XCykR7Hfv5NnKK5rpOl9gKtvlN4NfBgmsK92u7QXfH3xDESeW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+0/++xQepygOcxkxKZTwvwRwqWvRteBB3APyI6Y4+twV3I5K6CiTjssgUcvSe9HWwpHwzbtRLK5h8JlaOaHbuWYZOAtkqlSfCsqdYdOSqCqYIRSFfdhTyqp/Ws= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201703061421075)(20161123555025)(6072148); SRVR:CY4PR06MB2774; BCL:0; PCL:0; RULEID:; SRVR:CY4PR06MB2774; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 4:vdnsdr0ymP9NYNuvq0wbuHAOeLHsy3ovf80rach71pCVTG+SuE2IorkpUL6WkfvAExo9LdGZM2QakyILb0RxJdqYvyRNvrRstkRoVUmeceLp17JSB35OZ7WXdu2vrSq/odiXS6kIExcsOkca4YMhu3bWUaJXcegyOQ2+Tf0CutwM5B9UZeIf+ZxCZf7BDq58PhtQgOwYEnyvVmgU1lAVSj+PDfEV6DJkmkm5WZc7nw6Wtg23+CgAXCZhEcod5enW486gZmU6+Qpy0EfQhyE8kLUDx2Jga2QTw/lphroj/gysmRVU3PO/ZhcZdrMMT4K0M8D+oVox0a2sLppds5KMQ7VgWGHKDFoCe6RwbuE0PhBXyXBZozJTfXSkSC8hubBALASDFjQ4DXlFoNMMjvENVgxqA+nxL6C1sCmbRKl4wv/Xj5IEgme6WE9YBKSXZM75QnTxPrGeu8JqEU0YkGUj8M6cH81mrWMcjjlRogt2vdbqkiSKp1h7rHm+l6WVQu/5/AtOuVavDdAlZtT63EvXaEss0g2MUFM1NvQmRA3wH1XWBL4+SY2V+oNLiqW26fRwdw6u3c8FE5oG3R0P8it+bx1mJZlOnilbRAXW2LA5RVyURZe1B4kmeF6abqHFNl34lFJtSEdXyB/8/aHSWXDkO3kI3p/FLjAfcRE0GTmIQGsIVpC+NSjHlCXl6wB+pQrp X-Forefront-PRVS: 02788FF38E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39400400002)(39450400003)(51234002)(86362001)(305945005)(1076002)(6916009)(6666003)(25786009)(2950100002)(6486002)(2906002)(3846002)(6116002)(2870700001)(54906002)(189998001)(53936002)(53416004)(107886003)(110136004)(5660300001)(38730400002)(50986999)(76176999)(2351001)(4326008)(66066001)(5820100001)(23676002)(81166006)(47776003)(42186005)(36756003)(33646002)(50226002)(8676002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR06MB2774; H:skyninja.cnexlabs.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjA2TUIyNzc0OzIzOlZ4UWRTU3U5dEhpaHZ5Q1BiQnhDUDJ4TFNm?= =?utf-8?B?V3g0aU1SRnpVakNSem84WVhUeWdOUG5wK3AwQ2hmN1JyT0Z2azlLZXBKeGZV?= =?utf-8?B?Z2dIQTNnTjF4d2QvTERRRStsRXV3NEpVbUNjNDlPV1VITzdwR2ZxUU5iaVo2?= =?utf-8?B?bXB3azFiOXF0WEQ4V2dzU2YxLzd4YzZlSUhpUkpSRkZtdTJnVWFPOUgvTXl5?= =?utf-8?B?UXQ1NzNZQlVYS1huV243eWo4N0tXRWFUTXh0NVc1UnVucVgzUnpDMnNDd0Vq?= =?utf-8?B?MFFoMEYzVHRsL05MNk9ROUs4Wm0vYTRpcEdvVEppajRrRW4rRzEzOTIwNUxH?= =?utf-8?B?dzdhSG5pNHhlWHJKd1l3ODE0WEltc3Z3V3ZFcEdEeUhIdFNTemVScFpVbVkw?= =?utf-8?B?WlNVYktnRVpVNC90Ny9PdWFqZEZIT3RlTVpRRmkvUXhOUmNwR0xNc1FtL1Zw?= =?utf-8?B?Rkh1ZFlHU3daWllLRHhhMHhSdG5UajJKZ3VlcWFnUUxnNlpoRzBWT05DQVRl?= =?utf-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xqJDEKRu3L5pM+XzHqL0Rx2LH2ionPW1hwBaGdhBLruZLttXEEQLcJSCvGgFWqvBoFEAwH4xhSt4nQSdKdpw== X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2017 18:56:24.5768 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2774 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González Reorder disk allocation such that the disk structure can be put safely. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 5eea3d5..5f84d2a 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -264,15 +264,15 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create) goto err_t; } + tdisk = alloc_disk(0); + if (!tdisk) + goto err_dev; + tqueue = blk_alloc_queue_node(GFP_KERNEL, dev->q->node); if (!tqueue) - goto err_dev; + goto err_disk; blk_queue_make_request(tqueue, tt->make_rq); - tdisk = alloc_disk(0); - if (!tdisk) - goto err_queue; - sprintf(tdisk->disk_name, "%s", create->tgtname); tdisk->flags = GENHD_FL_EXT_DEVT; tdisk->major = 0; @@ -308,9 +308,9 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create) if (tt->exit) tt->exit(targetdata); err_init: - put_disk(tdisk); -err_queue: blk_cleanup_queue(tqueue); +err_disk: + put_disk(tdisk); err_dev: nvm_remove_tgt_dev(tgt_dev, 0); err_t: