From patchwork Mon Jul 15 10:47:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13733301 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D00DC3DA5D for ; Mon, 15 Jul 2024 10:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 04FF4C4AF0E; Mon, 15 Jul 2024 10:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD489C32782; Mon, 15 Jul 2024 10:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721040485; bh=Z85ohY/TriR5MifQgfR1EPcpJLeH2R08PF6O395cHGw=; h=From:List-Id:To:Cc:Subject:Date:In-Reply-To:References:From; b=dU2XYDpZyPNHxKdofcVtv5p96shYyq6FuGvindmziMpq84a/zFyMNOA31Et54vUl7 P1zljvApeQe+Pk+RjF3DxstR/ZfKDQWQcDPv0BTbii4iRlcf7VMg6UNarb0h/wWOtx SS30gu6faYoWtd8v0OwsfX7z0xJDqgrHZfKQGmnJcNmLGsc3rCeityebMNXREL+RAK BCd5PWEacHmC4JTQHDLtf2aBzTygwCMEgqTegwJucjrr+zpixcPnWJM3x7edbXC/iv Eu2JRqTMljH81GbekXcqGSiH6JGWaA85+EkZMByMU0QOHvNK/kmp1b1Kv6bsKDBOTo Gl0vvyy8ABD1g== From: =?utf-8?q?Marek_Beh=C3=BAn?= List-Id: To: Gregory CLEMENT , Andrew Lunn , Arnd Bergmann , soc@kernel.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH v4 15/19] firmware: turris-mox-rwtm: Use devm_mutex_init() instead of mutex_init() Date: Mon, 15 Jul 2024 12:47:19 +0200 Message-ID: <20240715104723.17751-16-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240715104723.17751-1-kabel@kernel.org> References: <20240715104723.17751-1-kabel@kernel.org> MIME-Version: 1.0 Use devm_mutex_init() instead of mutex_init(), to properly call mutex_destroy() on probe failure / driver unbind. Signed-off-by: Marek BehĂșn Reviewed-by: Andy Shevchenko --- drivers/firmware/turris-mox-rwtm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index d12e29625022..9f6bda969943 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -456,7 +456,10 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rwtm); - mutex_init(&rwtm->busy); + ret = devm_mutex_init(dev, &rwtm->busy); + if (ret) + return ret; + init_completion(&rwtm->cmd_done); rwtm->mbox_client.dev = dev;