Message ID | 0e8fa862e2d3da5897d0f895322d469e7d5aa052.1695979848.git.geert+renesas@glider.be |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3898257vqu; Fri, 29 Sep 2023 02:44:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwbSNwS+HDr7eQie2WcEfyrEocrm7E9JNA9nlgvdPZS2+o+ozq76Wvj9zzXhQd0RU2QzWB X-Received: by 2002:a17:902:e741:b0:1c4:1cd3:8068 with SMTP id p1-20020a170902e74100b001c41cd38068mr5963936plf.5.1695980647600; Fri, 29 Sep 2023 02:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695980647; cv=none; d=google.com; s=arc-20160816; b=IhnS18XKA0RcsHJQ6vm2nwui8pfjCxbWUwG9r+h3leti/W0cvyWjFTq6ahAgnyRoq7 fdWl+dnVHLRj7DnD7JygOsfHhTEqJB6cnf7f8lla6Y1qDTJJT8hi73xO7Rwv9iL0pEGR p9dOezLqIu+eyhRw4jln8inVzDFc1Dd9MRj/8YG1A282sz7ERrATcNhB9OkLlNuFBaQk bWNrjIvS9qjkrumGDCDBbT5PjtVcOfTit8K927KC0ecUObaG2k7xAPa7zMvPnzsJs4cu XaMGr1b9Ddwu8QYgmeEqtPQ+Qq+gztFqwgpuUHRdD5/dPOHCrnP+1i94qfw7b2GEInKB 0gzQ== 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 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id w67-20020a636246000000b0057759a5b7c6si7658063pgb.62.2023.09.29.02.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 02:44:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 D563C802F460; Fri, 29 Sep 2023 02:32:21 -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 S232919AbjI2Jbq (ORCPT <rfc822;pwkd43@gmail.com> + 20 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <geert@linux-m68k.org>) 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 <geert@linux-m68k.org>) id 1qm9qT-001eU7-65; Fri, 29 Sep 2023 11:31:37 +0200 From: Geert Uytterhoeven <geert+renesas@glider.be> To: Wentong Wu <wentong.wu@intel.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Sakari Ailus <sakari.ailus@linux.intel.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven <geert+renesas@glider.be> 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: <linux-kernel.vger.kernel.org> 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:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778364603389293764 X-GMAIL-MSGID: 1778364603389293764 |
Series |
media: ipu-bridge: Add missing acpi_dev_put() in ipu_bridge_get_ivsc_acpi_dev()
|
|
Commit Message
Geert Uytterhoeven
Sept. 29, 2023, 9:31 a.m. UTC
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 <geert+renesas@glider.be>
---
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(-)
Comments
On Fri, Sep 29, 2023 at 11:31:33AM +0200, Geert Uytterhoeven wrote: > 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(). Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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;