Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2981499rwb; Mon, 15 Aug 2022 15:23:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR69Ivlfvki8JRe6jZdhgYVrMo2YWCA4pPDjC/n2L79KzZB1qyTpqISTPmnM9BZX36jdY06v X-Received: by 2002:a17:906:8a73:b0:730:9af8:b335 with SMTP id hy19-20020a1709068a7300b007309af8b335mr12159229ejc.14.1660602209975; Mon, 15 Aug 2022 15:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660602209; cv=none; d=google.com; s=arc-20160816; b=s7qIhY7nREchZzrs2gJ0OUhyHgUwARu/Ir8uyOUQlFedaeZwrd6AkskR8XLg8iPDSy LD/znA/d1tkyHGN01MK13dh3WI7aLdDK5AMC1CNSSjfzIG5r3n8SuZQvtMd15IFEeVys QWjNjdMQNI08y0Z7TGl8lILVejr75MFzeh35ZtXVGEIPPmoh7TnTdty0mcg731AhuK4g W6znDYMoFZo4C514qL0aM5fx0l4hnmqKllTbp4+4rc1MySF0UmI+q/EEHbTZBz78EEi/ BZOp1kumOLD8awXaqFJwJe0QvPI8fu5g3kepL/I4Wne7pq1FnH1r5WWdLMi5J/u8t9Xe b8Qw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=idwp0/u3HjV0ElgptfLO8kgS329eClm3sYQUkXVosvY=; b=fjaXEtdJvNGdHBbsIss9c7xOCnts0dja/UNWHYQCTOZBs7g/TOu5JlLwCsYWnT8wkx O6J/6F2jm5B1XMw/2kby7Owh6gcURIUdY5CB0q+iQO+hOqT9ghRS0kHgUHDg8XfGO6+k KrB3ooXqN9dL2romzwsqVAswHxSsDXrDGH1Kaj75SqCB4vQ2XfplXaRgBkaeuc8NeQDL VJpWTTSJzuhZwtaak7JxE1ctEHgAFb8TkoEjijft+HhI8H5xeTmgze8Sv8kgHLftpA2G Hk+LrwUummDvnVmOTGRF61ZgvIcvHWBL4uIHEAInVcWSxXGRgbss5lBZ8OjmI2a6aiqO AkKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRh8mQfu; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a17090634d300b0072f231e80desi7511116ejb.420.2022.08.15.15.23.03; Mon, 15 Aug 2022 15:23:29 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=cRh8mQfu; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348732AbiHOWVQ (ORCPT + 99 others); Mon, 15 Aug 2022 18:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349634AbiHOWRK (ORCPT ); Mon, 15 Aug 2022 18:17:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A7192C115; Mon, 15 Aug 2022 12:40:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E6BC86120F; Mon, 15 Aug 2022 19:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A404DC433D6; Mon, 15 Aug 2022 19:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592420; bh=OBgG/fVVKPQLvqHzjSlNXO7UyFxMhf3DO59n0ZEWzTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRh8mQfu4PVUA2i2hk8g8fdTPVsrUeZWEmH5GFARgsKS89cyiP9+4CXMNidAHztyJ gjy+VLed2jojJmNLutfHcrTDyU5ik37163Qkb3NujxEIG91riXILIHBR7kUNPYzlmX 4vvs/mpXbAJNg9tCiUwUFCRD0ESna6BmWk3FGK68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0784/1095] mmc: core: quirks: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:03:03 +0200 Message-Id: <20220815180501.696161709@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Liang He [ Upstream commit 883c1d6fa4368a63cae2d6ae2d9c91141c60e233 ] In mmc_fixup_of_compatible_match(), we should call of_node_put() when breaking out of for_each_child_of_node() which will increase and decrease the refcount during one iteration. Fixes: b360b1102670 ("mmc: core: allow to match the device tree to apply quirks") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220719091051.1210806-1-windhl@126.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/core/quirks.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index f879dc63d936..be4393988086 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -163,8 +163,10 @@ static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card, struct device_node *np; for_each_child_of_node(mmc_dev(card->host)->of_node, np) { - if (of_device_is_compatible(np, compatible)) + if (of_device_is_compatible(np, compatible)) { + of_node_put(np); return true; + } } return false; -- 2.35.1