Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp240146rdb; Thu, 19 Oct 2023 03:10:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETnit86Hkp0nTYMayrl9ICmdDrcj+8h+Dbpn0mHPXzal0/G+O2gtq+N3QvyIFpoO/S1pUA X-Received: by 2002:a05:6870:aa8f:b0:1e9:5480:1df8 with SMTP id gr15-20020a056870aa8f00b001e954801df8mr2093207oab.51.1697710258324; Thu, 19 Oct 2023 03:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697710258; cv=none; d=google.com; s=arc-20160816; b=iDkxweG86s/CI7S4DfkHOs7mBjLKwxLpSU+OeASBwQceGLoNKLnZV0RNLYxzEmrU0g 98JL8cvHctJDX8rFZRRBb9YCb7Qza7n1FTnm3/JId1DZRPRysz3FK7Gd/EnZAcrcKyGp /Hi2L6mFdWicX1qeYrt6kBfZ4O/XHoL0SsA8hferWMeSCAZDIJ5akMQwQhAZq/Z4aF18 rIB3kthgUMTFc1xppQw8qrwR31KPq6AS+vXTcTGnAsLAPFOu6F0BsOEGHEZEbi3kWNRp usJ0tn+zzrQBbZ4HSF/gxoFdrny8z9eSC2+LYs+I5K8b+QlZsT5rw+bvmUGl9VozY/ji Tq3g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V00s/mVGgaCRB68RBbwNCsl4DRqLwcfW3IIuO/Z+Vmg=; fh=i3WS+6AgTKP10/eUP7j46CA4B/XR5qlEIT9hV1ltHe4=; b=dByewHpYFiFdauEtd+Fru7DQiwqQVF5iqyirfIVUXh7Hn61EmaMuD3XLnF0SpEPu7a wZDwbYS99nNqzDEaTGi5YKCszjIfXQPgjtgVVGQon1ZS6cYO9/7RkpZ94ircYxUwdHNp 2zvnvsR13qTpiGwLaVoFbTqXndSjZVhg4mjZPirlIhTP0f66NNOLl0xddUq69LN3duxj wxKEP1iUQlnUVEpgKOFNgnrJhpCGS0Lmn5/vvcQU4eHKRWMq+LF0j81MdFbfGNe5AbrG qh+6HLY8paPvfBS7UE6h2d/GmAL6uHnWAGBKWYq1x3GG/RcrRzslh9ovp5vjXp4ATu7P vs1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RadoXgs4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id v202-20020a6361d3000000b005641315d956si4077452pgb.147.2023.10.19.03.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 03:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RadoXgs4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 18604802A3CB; Thu, 19 Oct 2023 03:10:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345239AbjJSKK3 (ORCPT + 99 others); Thu, 19 Oct 2023 06:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345212AbjJSKK0 (ORCPT ); Thu, 19 Oct 2023 06:10:26 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF415123; Thu, 19 Oct 2023 03:10:24 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id EACCAC000C; Thu, 19 Oct 2023 10:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697710223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V00s/mVGgaCRB68RBbwNCsl4DRqLwcfW3IIuO/Z+Vmg=; b=RadoXgs4AZdQ45Rq8OCGmJcQ40bBQg7gztQWIZIhduC3qK/ToTZ5eYQHiS09J8F1qNeP8F tv4Sxge0hkziPnEY6JYWltoJOytUHgzt3MJKXELQJ6SfqfdIWwLEUfUZIlaFczhKOZz/5I Wum13MlhF6qQYoNFgxNtILhGi04ePLDGiaIAbqappzd6pZzfeayBLgNSZrfxfCZPN+d46u O5dMJxlGfCOPGdcJ10KrtOu8ALmxreJsvRbHJ+kPQ55C4RBsiVS/3EMENw/dL0xu8rABod usCkvcpv3phCB9lQfoXP4gQXu8tOcuci9emdJ7kaVArJqQ5GK7a8Jl8nK9XYQg== From: Herve Codina To: Wolfram Sang , Peter Rosin , Stephen Warren , Rob Herring , Greg Kroah-Hartman , Jonathan Cameron Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 1/3] i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() Date: Thu, 19 Oct 2023 12:10:14 +0200 Message-ID: <20231019101017.425284-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019101017.425284-1-herve.codina@bootlin.com> References: <20231019101017.425284-1-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 19 Oct 2023 03:10:48 -0700 (PDT) i2c-mux-pinctrl uses the pair of_find_i2c_adapter_by_node() / i2c_put_adapter(). These pair alone is not correct to properly lock the I2C parent adapter. Indeed, i2c_put_adapter() decrements the module refcount while of_find_i2c_adapter_by_node() does not increment it. This leads to an underflow of the parent module refcount. Use the dedicated function, of_get_i2c_adapter_by_node(), to handle correctly the module refcount. Fixes: c4aee3e1b0de ("i2c: mux: pinctrl: remove platform_data") Signed-off-by: Herve Codina Acked-by: Peter Rosin --- drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c index 18236b9fa14a..6ebca7bfd8a2 100644 --- a/drivers/i2c/muxes/i2c-mux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c @@ -62,7 +62,7 @@ static struct i2c_adapter *i2c_mux_pinctrl_parent_adapter(struct device *dev) dev_err(dev, "Cannot parse i2c-parent\n"); return ERR_PTR(-ENODEV); } - parent = of_find_i2c_adapter_by_node(parent_np); + parent = of_get_i2c_adapter_by_node(parent_np); of_node_put(parent_np); if (!parent) return ERR_PTR(-EPROBE_DEFER); -- 2.41.0