Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3800578rdh; Fri, 29 Sep 2023 02:44:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF30hJ/UyCyVuIVYiodgorJIwIXsz7KzJOdQT+t+HoJKIrS8v/1RPK3mHBv1NHR+cZ3qIZQ X-Received: by 2002:a17:903:228e:b0:1c6:2655:625d with SMTP id b14-20020a170903228e00b001c62655625dmr6819018plh.15.1695980641358; Fri, 29 Sep 2023 02:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695980641; cv=none; d=google.com; s=arc-20160816; b=ZGbrhh9W0ffX2ShaAahSi2BamX15NOFNFB67sB93KhAPxrsNTHevziHBy+c52GTpIf jK2GwWDkXPb1/74dWTY/ZRwedxbFElckD9w+o0tUmKaG7L0VsypdocKm1GXRvONy/tGp RzPsVdMQk/BPNIWeWLsgukXof5IkiIkgs4LjJkBsaX0V4Ownl3pufikcB0o31WSZqMtN p/v9eEHJEHrsFRnjz1Vk0o4a8gfLkKE0XcAaoFrZrixLhPPyOVrnROu8+pm1HyEHGRq+ GJFuGnSNhTwnMmN/IjGxN2hnNZKdZTcAfDtGFcg+gmnLL/bfKN6hwmuzRweoqM9EMHJo MEsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=nyU1CHaGi+oFE5Egsj+l+nNaWD3czOgWTmv3hmXGTZI=; fh=tBe0tOJXCJ5/knIsleKUdT/JlOpsQnDHBcudz0h9jwA=; b=N97ujSdmbYsiCscKdWDlSpR+MXQFR7KIpeQUNNYsXKcpZYf9aCRdknEeKWIC+JyEZl Wg33RR2nH9ZMbLh/6XyXiC1F+eEvLAYZfY5d/jTvCigwJnniT/06eso6ozvgU7sEtsIY tEckaoDibdWC/R0qUfTnM3SGR8232F7psZurgcgOM7WFOPZClqlfi5rpsEvsVifJ2QYY j4pZ6tjB/k6i8zKxUVUhvO4JvCe35Xq7nurJ+Expdos7i1xMCBeYOggVTG35qt57YNRJ 3//vSPqoz3xK717VyI9g7G32rdcvuWG3bn41qeh8FHOROnZ3ULuWJc12PkMqB4gzQ3A0 70+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i62-20020a638741000000b0056c2892bfb9si17904505pge.644.2023.09.29.02.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 02:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B790580309A6; Fri, 29 Sep 2023 02:32:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232969AbjI2Jbq (ORCPT + 99 others); Fri, 29 Sep 2023 05:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232915AbjI2Jbn (ORCPT ); Fri, 29 Sep 2023 05:31:43 -0400 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0609195 for ; Fri, 29 Sep 2023 02:31:39 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:e207:8adb:af22:7f1e]) by andre.telenet-ops.be with bizsmtp id rlXd2A00H3w8i7m01lXdHu; Fri, 29 Sep 2023 11:31:37 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qm9q4-004qHj-7y; Fri, 29 Sep 2023 11:31:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qm9qT-001eU7-65; Fri, 29 Sep 2023 11:31:37 +0200 From: Geert Uytterhoeven To: Wentong Wu , Mauro Carvalho Chehab , Sakari Ailus , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] media: ipu-bridge: Add missing acpi_dev_put() in ipu_bridge_get_ivsc_acpi_dev() Date: Fri, 29 Sep 2023 11:31:33 +0200 Message-Id: <0e8fa862e2d3da5897d0f895322d469e7d5aa052.1695979848.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 02:32:02 -0700 (PDT) In ipu_bridge_get_ivsc_acpi_dev(), the "ivsc_adev" acpi_device pointer from the outer loop is handed over to the caller, which takes proper care of its reference count. However, the "consumer" acpi_device pointer from the inner loop is lost, without decrementing its reference count. Fix this by adding the missing call to acpi_dev_put(). Fixes: c66821f381aed2c7 ("media: pci: intel: Add IVSC support for IPU bridge driver") Signed-off-by: Geert Uytterhoeven --- Compile-tested only. This driver really likes nesting loops: the above inner loop is actually 5 levels deep, of which 3 levels use for_each_acpi_*(). And all of that is done twice: ipu_bridge_init ipu_bridge_ivsc_is_ready for (i = 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) for (i = 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1) for_each_acpi_consumer_dev(ivsc_adev, consumer) ipu_bridge_connect_sensors for (i = 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) for (i = 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1) for_each_acpi_consumer_dev(ivsc_adev, consumer) --- drivers/media/pci/intel/ipu-bridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 1bde8b6e0b1121a8..e38198e259c03ce9 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -107,8 +107,10 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1) /* camera sensor depends on IVSC in DSDT if exist */ for_each_acpi_consumer_dev(ivsc_adev, consumer) - if (consumer->handle == handle) + if (consumer->handle == handle) { + acpi_dev_put(consumer); return ivsc_adev; + } } return NULL; -- 2.34.1