Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3230868rwb; Mon, 15 Aug 2022 21:47:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5A3OgJAsOQf6+3LHo+R84ao1oLdTIRKLzCr7gII3qEkIEmztclQO6dtTBdHHIIRHH63u0e X-Received: by 2002:a17:903:2303:b0:16d:c555:9b2 with SMTP id d3-20020a170903230300b0016dc55509b2mr20040559plh.46.1660625254634; Mon, 15 Aug 2022 21:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660625254; cv=none; d=google.com; s=arc-20160816; b=q4NEtaQ2dGIRrlty0Kuv5X5YPceHxzQVnZaXuUa0EVq14MEub2LkhkWWqGAtFcpqya lsjfg0oEOJ2+uVNEFWGPH+C/R4LkVNnDoXphxvjvluyr3yvoV6/24esMWUW+GTTuI2t1 4/6dLQ77pEsX8h5sgdnHzVHeV80XmOrEMZrKsN6HZUJvNc1sQoV3CHw8DzwILqYBlO/7 UU/23LJQWf8Bixt2+Tfacrk5lroXuG74Vksoa20rTaeTnBa0g83s25EO2/VbvMyX+uk8 rIbRM+8zqQJv1TyhVDH32AsacVVHwuGNUqrvCQviJHIfNHp3CVjGXvhect+c91/kOq/q Bcxg== 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=yfQy67H0KgnCmOSSm3UbmF/+sbEGFyHealiPE5uBMvHFnGESfzHSZ42FVLlT4j267w LVPVLGRcCoFgc5eQJgMU6W9YhghEV9h11jw3mKh2+824s2g/UdDl9c/FbM/QTRPhvDY4 retzoSQV8I9DJeYxWYYpiP2406xhIfUN32RI3j3JWxZ8utRXlLRP9Q/owEYp01kAIIT0 o+N/WMdQHYvh1yo0xSY/sh3OBBLr6ZjUqU3dy39ua2bB9Oc0wemPfNk1AszR1eClpVUd U1KFHFbocAlJV8QzdBhiHe87a901ahNgse4d2rEiMoXmMcQwL4KxPzqgtJc9sr5+3yFG 02Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SaIvpXbl; 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 cw1-20020a056a00450100b0052ad3d43859si10735072pfb.23.2022.08.15.21.47.16; Mon, 15 Aug 2022 21:47:34 -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=SaIvpXbl; 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 S232346AbiHPEpT (ORCPT + 99 others); Tue, 16 Aug 2022 00:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232820AbiHPElk (ORCPT ); Tue, 16 Aug 2022 00:41:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA6A3D2B3B; Mon, 15 Aug 2022 13:34:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id 98306B8114A; Mon, 15 Aug 2022 20:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1F3AC433C1; Mon, 15 Aug 2022 20:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595679; bh=OBgG/fVVKPQLvqHzjSlNXO7UyFxMhf3DO59n0ZEWzTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SaIvpXblbcNUqw2Eam/blmjrLGcI+Sx51Fwlde2nH8pxWHly3w1tMtmafQgs5gBTo 8NE3uvXRpCnJY2PrA05B8zLMABae2qdFytATusjXfix05cbk80cejXEfJRzLpgqUoS cpyRugJ8VHC018FxEs0mmbTmsMjNzvMxVrZLuLs8= 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.19 0841/1157] mmc: core: quirks: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:03:17 +0200 Message-Id: <20220815180513.131090688@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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