Message ID | 20230110204345.7266-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 p1csp2962841wrt; Tue, 10 Jan 2023 12:50:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyr4Ylb7HKUktL6enqwIYlk8sHD4w0C7zT9W0THfJbrAqPTw9aFq46GZR6ZZoxm6Mj/FGF X-Received: by 2002:a05:6a20:a590:b0:ac:29b4:11bc with SMTP id bc16-20020a056a20a59000b000ac29b411bcmr16145pzb.21.1673383835078; Tue, 10 Jan 2023 12:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673383835; cv=none; d=google.com; s=arc-20160816; b=NbC1eA/BSjQWJbf+D6yMNeFcR6PyTxvUrTQv/daM4fa61MHzhW5YaNvWbAzGSEKkVp 6mWyBKNnvYM8f0Q/KYo4rd9bN1+8JguSXX94qGrOha9I5+8V1JXRb7yP1p+/tidBl2Te MLk/7nRsRmBwPIF5ZHDPnkJBgrsiK5/MgYWe9yPCwPsNQv2n7lVtIF4Eb8puto45RdpT 7sCA+aYliRKbBt18IYVIudQ0WJcz/ljgDruRjyKlNRtRV3bT3/AHH5ZqoHLKoRaU7OU6 VRCmsp1mKiYnxCD6VIQestBjBZEJ9xx+AO83D5aI/3jR1nWoqHmswcadzaVwmd3Rlp57 xbGQ== 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=tBn6a5mqROf2ux/RUqvtiPAixck8rWx7TqClj/rZ30M=; b=xSv8dz7c8PBEwIbaiR+OtbF6yk75PqUI2vAV2tMO9U+rYhBuuvofFA3NDbmUUQtbG0 +CUqtCKhVk/omPOZDsHudv8TVAMOg6aII2Fnu+Mdj3a+wI07yXCek/BzbzeIzDjyWIIC eKm1KXWORgmOLDIFv1Qzkic6lSM6KOJSdsjasKPwsFjsnZ2qc4Se/vJcVAuWSz2eDW69 calQksuqCIrzKYaT1dbgUyic8TWs0n8al1A28W3lEGn+y4ccha7WzQi01wLXSb/mt0zJ c4XEQRTTeRdYdagKfpPsk78IviNwkn5ytV3CzOMtbT2ABVYe/Q+AHlqpKjhyJ+c+xuL1 5gjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GnJ9e51q; 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 e34-20020a630f22000000b00477c62b9498si13027708pgl.212.2023.01.10.12.50.22; Tue, 10 Jan 2023 12:50:35 -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=GnJ9e51q; 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 S231802AbjAJUoA (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Tue, 10 Jan 2023 15:44:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231354AbjAJUn6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Jan 2023 15:43:58 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DE2E4C726 for <linux-kernel@vger.kernel.org>; Tue, 10 Jan 2023 12:43:57 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id u19so31739461ejm.8 for <linux-kernel@vger.kernel.org>; Tue, 10 Jan 2023 12:43:57 -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=tBn6a5mqROf2ux/RUqvtiPAixck8rWx7TqClj/rZ30M=; b=GnJ9e51qhoXRcsPOK9yPQJirurHSYfA5N+CC3NI/ykAc2mDfNyevCeAY3UYdKP3RAl xn1a1LIKVvpDRkLybGBSKcbKjFoa87tCliab4jBFMagkYQLd7gcAbO/poJh1ukB+4LgN SgbQwqIfWfUlQ6igs46/dpS88Doxq4SyRTF8wHfB3aJsglWTx185wzI8oW9CkIKYMrNF epNhLNUNNA76m7GGrQWpQuG0kWEMycTiK1qcQt730zVmEZM62MucUhJMfDfZI/Kq5Dp4 cZ6Q+s01FMHdD+/pJqiMCPYi8zC1dpevWegKY4kiD/q1AwHAWP8v/e3QygVSVmI0dpeM Jxvg== 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=tBn6a5mqROf2ux/RUqvtiPAixck8rWx7TqClj/rZ30M=; b=4r1/kivHYts8d2zX3msZ6IoL6+0r3ndEWf0bPCPXhMlDsIr/ZA7fEYHeRuB7nhgma1 KbrvveB2l3QgGOtQtNHx1PAu96IwoFBfq2nYiY8thKOcLj0XCqA4GSLMZUm87aeAUtem 8Mx/2I7eDfRGM2scozODtyNXs6Dr19mlh38d7gv5cOFKyn++8/gTzAAi0SifU7Nn8wev ZCB1XtKp6skYYeKAxjrgjIHnN9U21cYWVHpTxgzxEld2iXyyBPOQ3x+eAoQQQeTO32NX +7Q3HHnAvoVQUQqy121W0gsX+gmVwFdsKHU5TgKQjkZIkSx5E+th7mDTTwSm5RxYktsV ZCEw== X-Gm-Message-State: AFqh2kqTb7vBGlaiVXQrutu9vPQAw/5Kc93xB/aD1RPiQzPlgwvDEZU+ 2s7f16lzpvIebjX6IFPQVD0= X-Received: by 2002:a17:907:c68a:b0:84c:e9c4:5751 with SMTP id ue10-20020a170907c68a00b0084ce9c45751mr26644373ejc.74.1673383436031; Tue, 10 Jan 2023 12:43:56 -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 lj1-20020a170906f9c100b0078d22b0bcf2sm5316479ejb.168.2023.01.10.12.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 12:43:55 -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 V2] nvmem: core: fix nvmem_layout_get_match_data() Date: Tue, 10 Jan 2023 21:43:45 +0100 Message-Id: <20230110204345.7266-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?1754670128243000765?= X-GMAIL-MSGID: =?utf-8?q?1754670128243000765?= |
Series |
[V2] nvmem: core: fix nvmem_layout_get_match_data()
|
|
Commit Message
Rafał Miłecki
Jan. 10, 2023, 8:43 p.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. Note: __maybe_unused is needed to avoid: warning: variable 'layout_np' set but not used [-Wunused-but-set-variable] (of_match_node() is no-op without CONFIG_OF). Fixes: f5709a684a0a ("nvmem: core: introduce NVMEM layouts") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Michael Walle <michael@walle.cc> --- drivers/nvmem/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On 10/01/2023 20:43, Rafał Miłecki wrote: > 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. > > Note: __maybe_unused is needed to avoid: > warning: variable 'layout_np' set but not used [-Wunused-but-set-variable] > (of_match_node() is no-op without CONFIG_OF). > > Fixes: f5709a684a0a ("nvmem: core: introduce NVMEM layouts") > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> > Reviewed-by: Michael Walle <michael@walle.cc> Applied thanks, --srini > --- > drivers/nvmem/core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index d112bb1328c1..d3be50ed2d0b 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -824,9 +824,11 @@ EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container); > const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, > struct nvmem_layout *layout) > { > + struct device_node __maybe_unused *layout_np; > const struct of_device_id *match; > > - 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; > }
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index d112bb1328c1..d3be50ed2d0b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -824,9 +824,11 @@ EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container); const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, struct nvmem_layout *layout) { + struct device_node __maybe_unused *layout_np; const struct of_device_id *match; - 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; }