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: 636212 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F2ACC001B2 for ; Thu, 22 Dec 2022 19:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235107AbiLVTPW (ORCPT ); Thu, 22 Dec 2022 14:15:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbiLVTPV (ORCPT ); Thu, 22 Dec 2022 14:15:21 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 346FC27DE4; Thu, 22 Dec 2022 11:15:20 -0800 (PST) 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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; }