From patchwork Tue Jan 10 10:46: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: 13094953 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 603D6C54EBE for ; Tue, 10 Jan 2023 10:48:05 +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=SIXuTPX/VTAbPccN0RoppM8lML6ie/N9WeSHPnR1avY=; b=cRGik1LK5bhTE5 CeM1a9MKwlIh26DtATpOHgJ1p/zZZTVGoGZLRpQEcSVsQ3y8OuHlsmqbj2HWRp72j/H3ytaCc6YTU jA1ohvfUpeqS7rYzm40Pl02pe0yVc8dBl3JX7RsJVS82E/f5RdMymanRT2F3O9U3vK2vzzLJ+t7nW U+IRYpI4m4oT/zi540m8P9xjFt1b0/EL6PGDcJreqAZEjIIW3Hau/XcVOHRsfrn04/c1Rq6cNPbMB oTiYCF6Xwnc6DSUIytppXLPlIMm1ro8VDF/E8QmWHbEDxhMyp4iYv0aWlzAkKhn67c70mnRL4MJYN QgPSazTfwocRjWMYOHPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFC9w-006PtK-0a; Tue, 10 Jan 2023 10:47:12 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFC9e-006Pq4-Ed for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2023 10:46:55 +0000 Received: by mail-ej1-x62f.google.com with SMTP id fc4so27437315ejc.12 for ; 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=aVYsxK5z8uShRLicPjO2ZiqBIL9r8Ygt/DwAeeFkNFKxkGmJWq74Dm/iC4PxUbExAf 6OphCluBEnzhB2uE7DMunwtKxD47OgQVsHvyzuKsYAhWqOlNpXrq3QKuSoSBoaTSArWF pb80D22AbU2hSHZcedb9UDbiAmGnHFbz7XgXbDBkIqvPhkYNN3zrGwz+yUQ16Iv4rcU3 TrvNCmfqhiU2nhis1Q01uNcMDIKviHAmlfJGSTz6bz+eJm/um1rqc9iusKpd1r7j9QH8 lHcqgIrmdDIrSzYP2KOmEN8eb3wJk77RldyVahpz+/5Yf5tB0MHq5/8xge8GImDDBM3c YPzQ== X-Gm-Message-State: AFqh2kqR5MIbgOD+4gAkv9R3UvLHh4Qh3L3GdfexsefEZyl5kCncSqmy 29q0g7AQmdbrm0TtiDagPxk= X-Google-Smtp-Source: AMrXdXscjTqcAgZUAUdYqOMmodnd+/UXytLrIMYLI4LYh2H2cwhU0Nh9StfQwyDwx/TT0379/4ZJwg== 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?= 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] 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_024654_519089_C37555CF X-CRM114-Status: GOOD ( 13.37 ) 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. 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..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; }