From patchwork Tue Jan 10 20:43:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 13095661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 563E1C54EBC for ; Tue, 10 Jan 2023 20:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hlYIDBADglMYXzqEK2I96kpmgWHwlBRZZ3cVIji6rMU=; b=3zf0hlCxPLPFOa jRH/0uRtfSMZdBMPhh+iKEl1h1dH8FSoDngDaZwePV0o5OeJUxhp/Tln6jTdjqTzyS6s3iwy5O10z fJEMYoDfLD6f7PFZBLWm1vx3KCAcYDHSW/75lhXbbsBcB4oRztGPaiDwuTRkfQomjlcsIEM5h+si7 /J8OSJkTyaZ3rwb9xI5uoQbkxDjH5ofzSZrRa7kXAJWNplDvSAPrvt+k3K7dhoYRx1E1MjYt7Vlci XiiYUOMb/TwS4Nc72F21kix5jliHFyQbx2duR4o2jIO2pswX91IzMaTOYrcYJ0ufDROl8acYFjhKp UpK1/4GShPpQLKsOxj3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFLTU-008VeB-Ju; Tue, 10 Jan 2023 20:44:00 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFLTS-008VdV-9I for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2023 20:43:59 +0000 Received: by mail-ej1-x62d.google.com with SMTP id jo4so31828854ejb.7 for ; 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=nD9xlmSCuHzZ0DUGKvBhdG3+8SZOFTaNrTqdETBRRQhRTdxMgAr3zQQQni4gbdhBYf 5q1CuPDnA8+rAMlzahi+giJeyqhHhbkv/NF+q3Yr1fEJSf5+POsFwvVi/kYKRMjhPipV 4lmDQcQOxQ3KocVzQDaiZ/OVeo5qPRuPQ50uH7i1pNMtaWAhq5JpHNaLfhq5ERYxyssv N5CQGI4YLM3Q6TxajHnvYMLMIRlmG+H8ZOpjdPoKuTc+ZG3vQPpRbXzCWL06I9xLKUSG h/xFoWfUfD0pYoeiAmNpbWuuvt0Vsb5H2Vn4/rdgmyd4bv6VF5j87qyxAAR5pLteP+p8 AnDw== X-Gm-Message-State: AFqh2kpbojsicRnyOcRHhQNjgTVhxGv/j6oL7Ez5gifrw9gHY/bCyB9R zatLxCGN1PATebC5lBdv4e4= X-Google-Smtp-Source: AMrXdXtR9++mivVh/HZDLLnDFezbpT4CJqhm6NCLX8+E443pWyNVQOb6GsBHruUCUKgIQcduR5yXnw== 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?= To: Srinivas Kandagatla Cc: Miquel Raynal , Michael Walle , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_124358_348409_BB8342AC X-CRM114-Status: GOOD ( 13.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rafał Miłecki 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 Reviewed-by: Michael Walle --- 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; }