From patchwork Mon May 25 08:58:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1297191 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=hcRTQ+43; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49VrdJ75Kyz9sRW for ; Mon, 25 May 2020 18:59:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6s3lt4LnQGQC4PAs4avcM4CKU2fZ0cUdk/yoJQ+tvjk=; b=hcRTQ+43NBLkcc WmpTCAtNANA+Q57e5aD6SMkTvFtI7Avkp4tgkppXIBJy8Rpy6ouXxVPp+NxDLVcXUCQYfdIjVkmo+ iBgAJEUQ3UxpYRfMTTUlvsWsLkNf5oxmDkTzp0P38yWXJ9FgRdPciQ/lwjN0R3guoqKx+plabsU2c sfbd0lzaOL8j1A728OJARYQaovnEOWU0udWPesDbk/fncfAGGPCs3IDNgqRUUX4XyPC+Fd5lqSeuS SFBeu/peQQzUnkfKaT6NqsXiYgF4HyufgOuf0BzxqVsT8VaquuEIyvuFCoWFCorFGIcmwNlxdx5yA iI+iq5dMDtQuNhxEqQBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jd8xM-0004xK-QG; Mon, 25 May 2020 08:59:36 +0000 Received: from relay10.mail.gandi.net ([217.70.178.230]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jd8wk-0004NR-HW for linux-mtd@lists.infradead.org; Mon, 25 May 2020 08:59:00 +0000 Received: from localhost.localdomain (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 178CC240016; Mon, 25 May 2020 08:58:52 +0000 (UTC) From: Miquel Raynal To: Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Subject: [PATCH v2 00/17] Clean nandsim error path Date: Mon, 25 May 2020 10:58:34 +0200 Message-Id: <20200525085851.17682-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200525_015858_724527_843029E3 X-CRM114-Status: UNSURE ( 8.23 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.178.230 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Miquel Raynal Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hello, As part of a bigger cleanup I realized the error path of nandsim.c was horribly wrong. There are a few additional changes, like having a consistent naming for a given object, but moreover this is an error path cleanup, driver-wide. Cheers, Miquèl Changes in v2: * Reordered the kfree() and the list_del() to avoid a use after free issue that I introduced in v1. * Used debugfs_remove_recursive() instead of just debugfs_remove(). Miquel Raynal (17): mtd: rawnand: nandsim: Consistent use of 'ns' instead of 'dev' mtd: rawnand: nandsim: Use octal permissions mtd: rawnand: nandsim: Use a consistent ns_ prefix for all functions mtd: rawnand: nandsim: Clean error handling mtd: rawnand: nandsim: Keep track of the created debugfs entries mtd: rawnand: nandsim: Remove debugfs entries at unload time mtd: rawnand: nandsim: Fix the two ns_alloc_device() error paths mtd: rawnand: nandsim: Free partition names on error in ns_init() mtd: rawnand: nandsim: Free the allocated device on error in ns_init() mtd: rawnand: nandsim: Free the partition names in ns_free() mtd: rawnand: nandsim: Stop using nand_release() mtd: rawnand: nandsim: Use an additional label when freeing the nandsim object mtd: rawnand: nandsim: Free erase_block_wear on error mtd: rawnand: nandsim: Fix the label pointing on nand_cleanup() mtd: rawnand: nandsim: Manage lists on error in ns_init_module() mtd: rawnand: nandsim: Rename a label in ns_init_module() mtd: rawnand: nandsim: Reorganize ns_cleanup_module() drivers/mtd/nand/raw/nandsim.c | 437 +++++++++++++++++++-------------- 1 file changed, 253 insertions(+), 184 deletions(-)