Message ID | 20230110104645.11705-1-zajec5@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2676635wrt; Tue, 10 Jan 2023 02:54:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXuc7kAfbtLYRIs9YNujnbIOMulkg2oqt1yeDlfJFYl78a7Q94biLqdkxbud8ArojQz4mCm/ X-Received: by 2002:a05:6402:e83:b0:467:75c6:4565 with SMTP id h3-20020a0564020e8300b0046775c64565mr63343100eda.9.1673348060291; Tue, 10 Jan 2023 02:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673348060; cv=none; d=google.com; s=arc-20160816; b=T21ZXjw4AMxTuG2neSeZRH45W84FevUHc6oHPTwz9rtuRh74kARWK1IKzoE4p28Rwe wRGkA7hF++02ruY90Imm0c90UPIoe7azL+kMgAZBXroMHIecBoi+96hTRzORY3djz63D fy991SJFhkJMc7Whdui2tEgu4PXO0lJtLiX5LB1BezDg+kw3iCPwmIoZvZULKfVbTOWI Gin0yiIUfqo28Ab8DrS0lC+bQbWTiJ3tD3PYEl0X8dRSeQQxus7Fc5X2m+dP2965CKJe 8owywOmwCHtmk9YAxyGdSKT6GCPA3UHC5EZFRcCVEuTKw0LnXBOCtx/fnIQ+EjfWsFZG jUbg== 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=EIA0Ch7czkrAOIXKFtyyregwgaXUOan8Cxs57O/xO7w=; b=c9qmHONx5iAETu30WCO0K7RtuVelznZHiKIUj3qnCScgMSOVZbAhAcjDBfbrJrmRS9 O/miywTb4Z2ISQ2ocy/l5kxtjPnUqNKtXEkxLwv1VRHb0ijEwdyBXnuykfExBphes7Wy vZfmNrF89Y4jXvm6PYvPbCxsWf4+CFPWqYzSLzdw22CWZ6aluEuxLI9pHYzD1cmeXx1l BysF5OlCuxkUXET7UNS8Pe32y3vPuqQcsn2ojYAQrV6o7WCtH1K64OYOmO4Yh3Jia/cG IPhN3qGZLga6zAevlzF7qyv9c+RKbRmUnjpbMwcyQ92b0+wHYFQVMcArOGpGt+bn3hDQ 12kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=d1u+lR+U; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a50d657000000b004819219f5fasi10799404edj.152.2023.01.10.02.53.57; Tue, 10 Jan 2023 02:54:20 -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=@gmail.com header.s=20210112 header.b=d1u+lR+U; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbjAJKr2 (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Tue, 10 Jan 2023 05:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238148AbjAJKq6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Jan 2023 05:46:58 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF03161315 for <linux-kernel@vger.kernel.org>; Tue, 10 Jan 2023 02:46:53 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id qk9so27495156ejc.3 for <linux-kernel@vger.kernel.org>; Tue, 10 Jan 2023 02:46:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EIA0Ch7czkrAOIXKFtyyregwgaXUOan8Cxs57O/xO7w=; b=d1u+lR+Um/rMc3+k5qC82G+/28nfRvbGzGMD0KvMysuQUeL17UqUIQ312jKurJxt0x DWzbccuWkrP96LTn5X1A16YAGVh7G5G/ttNC+SnptCF/JqW/JTBrkdSZDAB63GosZtlH n9psb4G0EKeqRJgk1IrBMx4AeJj03sWrxOM25u23kAlMMh0naTHi/VuXRUHUxylxlg3P E0c8hQmlrAgY+GvHneSNOf1atK23xNWzpZJMpGz1wKZ3rKBEs44FIJGRJCnhZ0el8ohO 6/BcaheNYFl4ZMjyz6xe03lpY0EZBBI+e9xL9anKqJErBvzmyPnnjJ/ZltgxzXats3f1 JsYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EIA0Ch7czkrAOIXKFtyyregwgaXUOan8Cxs57O/xO7w=; b=U9V62N2rngWfUhSksn6aLLuRBBRhc+cXBW/qbEAajQ7r/sb7AZTC114qT7ZLjbya7B 4cPi6yk/x54wCqNISZE8k4sZNUZqWUQwJUsRiQgkgTUT9HdDb1d5kIMurvLbTexX77gF evnYz+vD8bSVZbFohss/7SeiyaInkkc5v6eq74I5rNiic1IqSJFYoGmlSHBSZypWFmfX MMJqYYHKIWz07z45rINRiAjzJ6GZV61xQhqQ3/Z45zR4hYdrhYMl8MXZJ8CfPOKRN/Iw 80tf3JywN7IU5XdjlmFOSGgeeRHRAG4ccHn4vrBpyjYIdZ0Qel1FXRQaoffrIq80IkQK YtOA== X-Gm-Message-State: AFqh2koQOYEIlhy2+DF59Bns/iWFW83csPeoI3k3s1M4SndbxiHUejOj 3HhMF08bP2EegM6dMwSKJWM= X-Received: by 2002:a17:906:65a:b0:7c1:7045:1a53 with SMTP id t26-20020a170906065a00b007c170451a53mr53297446ejb.15.1673347612294; Tue, 10 Jan 2023 02:46:52 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id pv7-20020a170907208700b0085214114218sm1175023ejb.185.2023.01.10.02.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 02:46:51 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= <zajec5@gmail.com> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Miquel Raynal <miquel.raynal@bootlin.com>, Michael Walle <michael@walle.cc>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= <rafal@milecki.pl> Subject: [PATCH] nvmem: core: fix nvmem_layout_get_match_data() Date: Tue, 10 Jan 2023 11:46:45 +0100 Message-Id: <20230110104645.11705-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754632615828111797?= X-GMAIL-MSGID: =?utf-8?q?1754632615828111797?= |
Series |
nvmem: core: fix nvmem_layout_get_match_data()
|
|
Commit Message
Rafał Miłecki
Jan. 10, 2023, 10:46 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl> This function was trying to match wrong OF node (parent device's) against an of_match_table. It was always returning NULL. Make it match layout's OF node against layout's of_match_table. Fixes: f5709a684a0a ("nvmem: core: introduce NVMEM layouts") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> --- drivers/nvmem/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Comments
> From: Rafał Miłecki <rafal@milecki.pl> > > This function was trying to match wrong OF node (parent device's) > against an of_match_table. It was always returning NULL. > > Make it match layout's OF node against layout's of_match_table. > > Fixes: f5709a684a0a ("nvmem: core: introduce NVMEM layouts") > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Michael Walle <michael@walle.cc> Thanks! -michael
Hi Rafał, I love your patch! Perhaps something to improve: [auto build test WARNING on linux-next/master] [cannot apply to soc/for-next linus/master v6.2-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/nvmem-core-fix-nvmem_layout_get_match_data/20230110-184843 patch link: https://lore.kernel.org/r/20230110104645.11705-1-zajec5%40gmail.com patch subject: [PATCH] nvmem: core: fix nvmem_layout_get_match_data() config: alpha-defconfig compiler: alpha-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/cfe1a8f0e01284c430ab2395b321a460862aed4f git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Rafa-Mi-ecki/nvmem-core-fix-nvmem_layout_get_match_data/20230110-184843 git checkout cfe1a8f0e01284c430ab2395b321a460862aed4f # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/nvmem/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/nvmem/core.c: In function 'nvmem_layout_get_match_data': >> drivers/nvmem/core.c:828:29: warning: variable 'layout_np' set but not used [-Wunused-but-set-variable] 828 | struct device_node *layout_np; | ^~~~~~~~~ vim +/layout_np +828 drivers/nvmem/core.c 823 824 const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, 825 struct nvmem_layout *layout) 826 { 827 const struct of_device_id *match; > 828 struct device_node *layout_np; 829 830 layout_np = of_nvmem_layout_get_container(nvmem); 831 match = of_match_node(layout->of_match_table, layout_np); 832 833 return match ? match->data : NULL; 834 } 835 EXPORT_SYMBOL_GPL(nvmem_layout_get_match_data); 836
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index d112bb1328c1..1f05f0a50d86 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -825,8 +825,10 @@ const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, struct nvmem_layout *layout) { const struct of_device_id *match; + struct device_node *layout_np; - match = of_match_node(layout->of_match_table, nvmem->dev.of_node); + layout_np = of_nvmem_layout_get_container(nvmem); + match = of_match_node(layout->of_match_table, layout_np); return match ? match->data : NULL; }