Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11046120rwl; Mon, 2 Jan 2023 12:50:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXtvJKizbFL9tjVQFYYh8qvptLBNXpYgBQxQw1XXDesiX1DzwrLzp4P7SyQadI+N13+eJRE8 X-Received: by 2002:a17:907:9625:b0:7ad:9455:d57d with SMTP id gb37-20020a170907962500b007ad9455d57dmr38403845ejc.74.1672692625477; Mon, 02 Jan 2023 12:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672692625; cv=none; d=google.com; s=arc-20160816; b=kGH9nN44EEM/xWsVXt4TwQcd3TeBjsp6XPuoNclk8eTP6qCMilG4EVSxs1Inly9yWt REXFutf9uoZJUmPRCu3iKWRPafBNpUxpeIM2+Nk7gUoAFvYkpYnF/6cIQ7FYdPnTtyPu Gsvly95pfYMwEaW2vCTb0O+6QWYrAuJlmtRy1/m6/nxtYzbx1iPirYSRIkpZWU4k42fT QO/q7cLSTbwQL7/vbbjMwJqYYSMUb+MTtpM/+XnRqvWCXSLEqHDLzS21yBrdnqajH8CI NnLOcsiQREUyvf7I3jysK/OTeG33NaZsO6zWg8tYkIjop5bSPYWm6F/utwESb3KQ2qjq 6Gkw== 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:dkim-signature; bh=gQiJDONxlqo0qG6x+vunmt9ct1u3wo6H9DMtw2Nx+uo=; b=sLp8RUqea9fmIdcez1O/OUs1tjF9JxXu+rGntgHIHthWGuFOnauMLPUiX3XPpn3J2v /yRGq5Jqf0B7Eo9ZueHTHWQ+CUCUlWAL0yolMQFmJLWSPB7pAKVy0fUNc6jGzbGEwoac opJt9+8TCoIrlXBJBxydscMYH7g1r06U8cFMkJibCzOECJRgKbceWCamgaovZY/L83dy cqmIKBYT67N5CxABhUrDvRGxz6yg2TY3EoXGLqVHiPQXDdO5Uc9OebCyN044SQU5kvqv ikBnXCsmm3ILybhgHGVevg73rRJYQxjZ6xCx+QI/2s+dhO7fAdUr3Q+FRbdVRZevGYls HbRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TJxhhaaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt8-20020a170906ee8800b007c4f9ce306esi25235068ejb.729.2023.01.02.12.50.11; Mon, 02 Jan 2023 12:50:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TJxhhaaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233831AbjABU30 (ORCPT + 62 others); Mon, 2 Jan 2023 15:29:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbjABU3H (ORCPT ); Mon, 2 Jan 2023 15:29:07 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF45B7F2; Mon, 2 Jan 2023 12:29:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691346; x=1704227346; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qEdpGg42v8ssTX3MFNxTT74JRBUnoi0KLVf3ao4NExY=; b=TJxhhaaz4noZgwe1woo6KjgACjOqhWo0Am454D35KhCDsDeJOrdRcFar HcB0JK39hUzWM0ua7if2VYG1+BkD1lJcX7iYCK+ZWdIq7nRylHsn9PQmP wx8pIYGWAFUWpqHP6ae6lcLOEUrVWd1SY+Gs/pnRD+Q+QzCoDWRe8LDsp PMlRNJzSIGqnNhSY1KRj398LJYmea3uGOIFwod4+lJ+wlUlEE4J07mB3h PEMqhSuNQJN+3MdkVdUn3Y0KgZqcXmP9S1g8rTLSJCW6N/Dml+gSnIugA WEgQzUomzExwE4r3CSy5zweVHZMF/XVmZxyJ8N6tsc3tdo/kn7CED8lEv w==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="407798342" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="407798342" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="828649687" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="828649687" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 02 Jan 2023 12:29:04 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C8B0EF4; Mon, 2 Jan 2023 22:29:36 +0200 (EET) From: Andy Shevchenko To: Heikki Krogerus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Andy Shevchenko Subject: [PATCH v1 1/2] usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count Date: Mon, 2 Jan 2023 22:29:32 +0200 Message-Id: <20230102202933.15968-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When acpi_dev_get_memory_resources() fails, the reference count is left bumped. Drop it as it's done in the other error paths. Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect") Signed-off-by: Andy Shevchenko --- drivers/usb/typec/mux/intel_pmc_mux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c index fdbf3694e21f..87e2c9130607 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -614,8 +614,10 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc) INIT_LIST_HEAD(&resource_list); ret = acpi_dev_get_memory_resources(adev, &resource_list); - if (ret < 0) + if (ret < 0) { + acpi_dev_put(adev); return ret; + } rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node); if (rentry) -- 2.35.1