From patchwork Thu Dec 22 19:14:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13080250 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 980B2C4332F for ; Thu, 22 Dec 2022 19:16:55 +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:References:In-Reply-To: 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: List-Owner; bh=CkNBkOMC7CoIVM8F2Ripv56m64n/kH/3hMZamOdjXak=; b=dB1a/nC1LCFpVd Do1w+6vhKaU9KyD3YrvUDOoaLIvznI4bOQuvyB0rPgjRJSck4OAeHyCjekGdLYf4uZPOx16xxTy4N gkokmjaMtD3rnpBb6hBx1X8f+6i3jHRg/2QAjgJxNKpYQtiVxlGsPvJhHK85sTpclgJ/LXi7kVnfk TTqOvIGmIpKlJfjQb/Q9S07oBjmnIgyy6CLHJRLIJqvpMipWji9uI0gSiSOTk3BMklkKS+OUgM7cT 1928k6BgwBB0eTOeqrNbI45o5+dM16hwLa/ARuz3jMMaYBSM79eVkTM0tlI4Lrhg2WtZIfBXiYa55 u6oJjWcqE5eyFm2JVr9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p8R2l-00FoPU-Rk; Thu, 22 Dec 2022 19:15:52 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p8R2G-00FoAe-6V; Thu, 22 Dec 2022 19:15:21 +0000 Received: from umang.jainideasonboard.com (unknown [IPv6:2401:4900:1f3f:d076:4da6:b729:f032:ed0a]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 42193890; Thu, 22 Dec 2022 20:15:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1671736518; bh=6uYCqoGzATUwi33s8qwvH2BR201HZIZgkpsRD/uga5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngtNY6j8Irf0q8DYlJnrYOOiK2jqTxM+kAzkuHj3rAgfw3ZJABT0ddX64ZpV3JJ1P NM9rWtLFodm8PIs2zQIisV8Iswy9mhy0JyIS0qXs3yVy1vdnZ5zXj2speGm+fyQJju VmkFWDDPv1gYfAVBZ0PMD60gGTEPetazrd/wcVY0= From: Umang Jain To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Greg Kroah-Hartman , Adrien Thierry , Stefan Wahren , Florian Fainelli , Dan Carpenter , Nicolas Saenz Julienne , Phil Elwell , Dave Stevenson , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [PATCH v2 1/4] staging: vc04_services: Stop leaking platform device on error path Date: Fri, 23 Dec 2022 00:44:57 +0530 Message-Id: <20221222191500.515795-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221222191500.515795-1-umang.jain@ideasonboard.com> References: <20221222191500.515795-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221222_111520_423831_63758A7F X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. 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 vchiq driver registers the child platform devices in vchiq_register_child(). However, in the registration error code path, currently the driver is leaking platform devices by not destroying the return platform device. Plug this leak using platform_device_put() as mentioned in the documentation for platform_device_register(). Signed-off-by: Umang Jain --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index dc33490ba7fb..fc7ea7ba97b2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1779,6 +1779,7 @@ vchiq_register_child(struct platform_device *pdev, const char *name) child = platform_device_register_full(&pdevinfo); if (IS_ERR(child)) { dev_warn(&pdev->dev, "%s not registered\n", name); + platform_device_put(child); child = NULL; }