From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 964D0C433F5 for ; Sat, 25 Sep 2021 00:49:33 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2A9A6103C for ; Sat, 25 Sep 2021 00:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2A9A6103C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0E3B082D7C; Sat, 25 Sep 2021 02:49:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Mt/NGnff"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3139082C88; Sat, 25 Sep 2021 02:49:28 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 526E382C88 for ; Sat, 25 Sep 2021 02:49:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id E644F610D1; Sat, 25 Sep 2021 00:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632530962; bh=Bdk4L8Fmt1/HItQ+gzJxzsaCVdgLzcnJf7E09/CgMSY=; h=From:To:Cc:Subject:Date:From; b=Mt/NGnffiib67//C20xbBPzDgo8l7PP6a17rN3bk6Ravj5ow+q8NRkzVVW1BKobKH rBPv8bPWSBnVwrJcvCKbtvjT3ViY1pIAz6Up1tGvVSY4glZGuykRglTBaosN/PY366 ciSKF/KFLnqPZaAXoVEnngzl14NaxjVF3fyNJYRcDucYSXfwkNGGIBbmVYbK3uPhyO ZkxwKnt6ndR8T1OLQvMsBSpCMinNrxAQDFRhZAdrZB58Q9hWHWkkR7rUetLtiCKRbm gDtm+Dk3CQSrSxIRdljXrTjrIOlhmaHO08RHCbqKfjQlKC3VZN1E+ldbL+ZpsXKvZp x1mA52i8NhhGA== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device Date: Sat, 25 Sep 2021 02:49:18 +0200 Message-Id: <20210925004918.30818-1-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn After getting MTD device via get_mtd_device_nm(), we need to put it with put_mtd_device(), otherwise we get Removing MTD device #0 (mx25l6405d) with use count 1 before booting kernel. Signed-off-by: Marek BehĂșn --- board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index bac78af04e..a48e1f5c30 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd) if (!fixup_mtd_partitions(blob, node, mtd)) goto fail; + put_mtd_device(mtd); return 0; fail: printf("Failed fixing SPI NOR partitions!\n"); + if (!IS_ERR_OR_NULL(mtd)) + put_mtd_device(mtd); return 0; } #endif -- 2.32.0