From patchwork Fri Apr 22 14:17:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12823539 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 22190C433F5 for ; Fri, 22 Apr 2022 14:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=zqOtY8ymDcTeukRHiZo02vvKMWNWFlEd76g+yueoE7k=; b=d7DpWp4wy9zBrX 8MXGQ5jfavyjMNO9xa+maEz5aYzzEVDjlt9GHsT0XOMsdsRpDds4WT5mzbt/HqGQd/w2DlBHfC2Cc AvT25bOmslDN1vG6JC7Li4GJedjM9zw++H5CA3SOP4U+c+7KYYRrTP92iPeq0qjnX924FnOmomTg1 WDtQrQRWJPW3OaYpSnhQS1aITcj3a5zVKw3iHrvwlRdKVrfVK5FTNrc2t76tdUC0LJI5k583Zf/ak CdwTuJOpXiRuZq8rNYocQ+EkPXdQPm3OgeJBb3J4hT9hfWaiHj7/JGkvt4klHXYLs0iF8RNNnjjyI rnChN7h7iPOIQ5Sn/Flg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhu6K-000m33-Ka; Fri, 22 Apr 2022 14:17:36 +0000 Received: from smtp06.smtpout.orange.fr ([80.12.242.128] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhu6H-000lzg-3n for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2022 14:17:35 +0000 Received: from pop-os.home ([86.243.180.246]) by smtp.orange.fr with ESMTPA id hu64nHsTWXeonhu64nsPbR; Fri, 22 Apr 2022 16:17:25 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Fri, 22 Apr 2022 16:17:25 +0200 X-ME-IP: 86.243.180.246 From: Christophe JAILLET To: Aaro Koskinen , Tony Lindgren , Russell King , Tarun Kanti DebBarma , Thara Gopinath , "Cousson, Benoit" , Santosh Shilimkar Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: OMAP1: Fix error handling path in omap1_dm_timer_init() Date: Fri, 22 Apr 2022 16:17:18 +0200 Message-Id: <89cad160be5b186d8f6fd79bdb6ba3fa5e4bb53b.1650637013.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_071733_333976_65ACE960 X-CRM114-Status: GOOD ( 13.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org platform_device_put() should be called instead of platform_device_unregister() in the error handling path because, at this point, no successful platform_device_add() has been called. While at it, change the goto label if kzalloc() fails. It is harmless to call 'kfree(NULL)', but it is also pointless. Fixes: 97933d6ced60 ("ARM: OMAP1: dmtimer: conversion to platform devices") Signed-off-by: Christophe JAILLET --- This is a speculative patch, not even compile tested because of lack of cross-compiler. So review with care. --- arch/arm/mach-omap1/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c index 0411d5508d63..f91ba2353345 100644 --- a/arch/arm/mach-omap1/timer.c +++ b/arch/arm/mach-omap1/timer.c @@ -135,7 +135,7 @@ static int __init omap1_dm_timer_init(void) pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); if (!pdata) { ret = -ENOMEM; - goto err_free_pdata; + goto err_free_pdev; } pdata->set_timer_src = omap1_dm_timer_set_src; @@ -165,7 +165,7 @@ static int __init omap1_dm_timer_init(void) kfree(pdata); err_free_pdev: - platform_device_unregister(pdev); + platform_device_put(pdev); return ret; }