From patchwork Tue Jan 30 09:56:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 193971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1120347dyb; Tue, 30 Jan 2024 02:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJS15g7xvzLpTHN+0Te3uXUpTbleFNfT5rzW4udQCMRNVb01xPkxVkjy+NtOEj3o5yHW/Q X-Received: by 2002:a17:903:1206:b0:1d7:35ba:6a39 with SMTP id l6-20020a170903120600b001d735ba6a39mr4853499plh.69.1706610414811; Tue, 30 Jan 2024 02:26:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706610414; cv=pass; d=google.com; s=arc-20160816; b=UXceiZwn7SH5WIzWkVFtkA7w1ZdO3QqfEBzwPz19GFHos9FmTHCW66MpLcb/wabiRw YzwaWar0DtUOPEhzoXqi828Yk8ayJCJFpMfV67s70N9JnUuzgRD4SLsd8Q+lNQj5Q31k hObHJjq4TuUuqPK7zBXOEuPA1gyHq4aIoDAS9iitpbPFMi0xk7npDU+whPYSF24jtj1Y J97Z4p6jlWRSypSKZr/V4/ke95zEnOJVZPIAGvMKk2wTZ3vFeN0Xfp+fZKJyGmHO35CM hGozlPLisNYZrF3Spj1c5BaoV381Kto31JqfLqYXaEwUItTEOer3dBEIosWWt4giy5ED I5kQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sMxRirpa263d6PmLZyC9XRaAp28SbobvUK5ST0uEzHo=; fh=T29NK0a2UgpyPMJNdRdxOwtTMCeLNbJCj+OzYaaxEOg=; b=ZRlungsShKAYLq1Cl/KdEDl8pH2K/A3M6yWvjzLzFUmCraCnspNICxDHet7m26yelD cDZXnpBPSBezk5E+jtVFNTIIRCubXFnRK1xalTaMXQ09zvWtanHuh8l5ydTxTBJWT3D8 m2A3N3I5b7Lt/LH11SlQDShSFkaT0YFB5wL0zLsAma/w4G7XY78PJ/iVPQh/VJYwIMUD BPXiN78EGr/s+xXK5s9v2xt5WHPmmSsKYgqMHXq1pDpgNjf4Q08EFqWV5dPKJHaQ/u+0 0wsS0YUsAIpwBhtUmKeTXurHQSWc39zeSSZZ3iKLfLDGORCtbuGLywCylRDdYwynKhD2 DZnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j0zXpjZv; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-44333-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44333-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jw3-20020a170903278300b001d90bfa4f6dsi799993plb.276.2024.01.30.02.26.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:26:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44333-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j0zXpjZv; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-44333-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44333-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BA97FB2A40B for ; Tue, 30 Jan 2024 10:01:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C452367740; Tue, 30 Jan 2024 09:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="j0zXpjZv" Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D168664CC for ; Tue, 30 Jan 2024 09:57:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608624; cv=none; b=cDBJMjTqbk4WQ62kyWnB4/Pm9FAdBf3Z2/HHjqntJvTBWUVk+TtcRmeJw8LXjzNFlGbPVeLSD1Jpp9SwJhT6jQGdIwXOw94s+RuzpGa5ASiZ9tSnEbH/x3uyB+vTwsnk9R5edyfEzPHJHadM5C7GK+C2+cDx0lQ4GPuRqxL/o5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608624; c=relaxed/simple; bh=T0JtsjOKE5HCH9JwYSPgNeRdUS2v7ajLCNvW4doHSaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zyf0Gh60U8bwBCQjVxTekbnEisR1JFnTLI69qo8puR31iQXK4qKsPR/YwN2YoB2dAwVVMRS6pUPjPXw8n8goOKzZt4KXVyM3mcHYbsY6Rg/fd/kB/cenzcssTX8YcbGIa4G/+8X5MmSfoYyQ1lwf+WomiZEECaG6NP7QRyUs5V4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=j0zXpjZv; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso1707752a12.3 for ; Tue, 30 Jan 2024 01:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706608622; x=1707213422; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sMxRirpa263d6PmLZyC9XRaAp28SbobvUK5ST0uEzHo=; b=j0zXpjZvcSjmhpN2odRPSr8w1meoWgS4+CpHBaSbrN3VAbrKVVbVJwL9UAHrf4YEy6 1VuxkQJj4umUnFFuVpsj8LUCDJjUXrUplTEV33XWvyaHDk05wX2SbxChUk3AN4qg2P7+ QNnTtkrmBOunq0NET/2Ooj4ZOC348X21NZWh4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706608622; x=1707213422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sMxRirpa263d6PmLZyC9XRaAp28SbobvUK5ST0uEzHo=; b=hF6rLGzaP4XFlIWuaLhQzszTAc9XGnlvSyqlIUFfzLldCiqR2gs0z0wG3Gfh5+61z4 wGGus5hEsbXDSN5GEXOTnHl7hGZqfzat5wA4QnVvY1yeEzAtxGTCXQnP24Ww4lcQUzbg j/MIVpmq6Zqk4Eb/QtNgSuEQ2FPzF82Or1lHHpxrl9Y4y9WJhY7OmZAKqQ59d2QdIxgk auaWC+PZT7U/casE/BvDtnRNfF7cvHzJ0e9qwIGBsqCyRwkYq5oY3ZMVXpkAc7nIFd+L jVhGfx1cKVZDbE7c7rtOy3U5aRsxD0o8rV3lI36xHeKrebz54V4M115Dj+OlbSVIF8kU hNhQ== X-Gm-Message-State: AOJu0YwvSKN83CifQGCXyYiFfgQZWeRvb6HtqJexLCRMT/2NJmJpxtZG nClpk975WbcCGHnhjKi4KQSlRwU6NZzDBh38HA3ZPCrF4Rn3kW0GjmVD1dL22w== X-Received: by 2002:a05:6a20:3f95:b0:199:c8f1:58 with SMTP id ay21-20020a056a203f9500b00199c8f10058mr4049745pzb.41.1706608622688; Tue, 30 Jan 2024 01:57:02 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:469:110f:d748:6896]) by smtp.gmail.com with ESMTPSA id sm5-20020a17090b2e4500b0028ffea988a2sm8069810pjb.37.2024.01.30.01.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:57:02 -0800 (PST) From: Chen-Yu Tsai To: Matthias Brugger , AngeloGioacchino Del Regno , Srinivas Kandagatla Cc: Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, William-tw Lin Subject: [PATCH 1/3] soc: mediatek: mtk-socinfo: Clean up NVMEM cell read Date: Tue, 30 Jan 2024 17:56:51 +0800 Message-ID: <20240130095656.3712469-2-wenst@chromium.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240130095656.3712469-1-wenst@chromium.org> References: <20240130095656.3712469-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789510722167912188 X-GMAIL-MSGID: 1789510722167912188 The mtk-socinfo grabs the NVMEM device devm_nvmem_device_get(), but then proceeds to put the device directly with nvmem_device_put() if the read is successful. If the device fails to probe and goes through the devres release path, the device would be put a second time, triggering a use-after-free error from KASAN. Fix this by dropping the devres part. Since the NVMEM cell data is read only once, there is no need to keep the reference around. While at it, clean up the function to directly reference the NVMEM device node and use that to find the NVMEM device, instead of finding it by name, which is more fragile. The cell node is always a direct child of the NVMEM device node, courtesy of the legacy NVMEM cell layout. Thus of_get_child_by_name() is a better way of finding the cell. Last, correctly put the device node once its use is over. Fixes: 423a54da3c7e ("soc: mediatek: mtk-socinfo: Add driver for getting chip information") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-socinfo.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/soc/mediatek/mtk-socinfo.c b/drivers/soc/mediatek/mtk-socinfo.c index 0094f43e1e08..3909d22062ce 100644 --- a/drivers/soc/mediatek/mtk-socinfo.c +++ b/drivers/soc/mediatek/mtk-socinfo.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -82,25 +83,28 @@ static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo *mtk_socinfop) static u32 mtk_socinfo_read_cell(struct device *dev, const char *name) { struct nvmem_device *nvmemp; - struct device_node *np = dev->of_node; + struct device_node *np, *nvmem_node = dev->parent->of_node; u32 offset; u32 cell_val = CELL_NOT_USED; - nvmemp = devm_nvmem_device_get(dev, "mtk-efuse0"); + /* should never fail since the nvmem driver registers this child */ + nvmemp = nvmem_device_find(nvmem_node, device_match_of_node); if (IS_ERR(nvmemp)) goto out; - np = of_find_node_by_name(NULL, name); + np = of_get_child_by_name(nvmem_node, name); if (!np) - goto out; + goto put_device; if (of_property_read_u32_index(np, "reg", 0, &offset)) - goto out; + goto put_node; nvmem_device_read(nvmemp, offset, sizeof(cell_val), &cell_val); +put_node: + of_node_put(np); +put_device: nvmem_device_put(nvmemp); - out: return cell_val; } From patchwork Tue Jan 30 09:56:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 193943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1110271dyb; Tue, 30 Jan 2024 02:01:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVwYwuRnkpfROEwpJJlsERIlHeKL8EEDm1v56aJEm+Fm+u0LFa2ZpZRzTvkIPGANf7Tgfv X-Received: by 2002:a05:622a:15c8:b0:42a:b844:5d36 with SMTP id d8-20020a05622a15c800b0042ab8445d36mr977022qty.5.1706608917770; Tue, 30 Jan 2024 02:01:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706608917; cv=pass; d=google.com; s=arc-20160816; b=wh42HUEY+K5uQrEsn1vRVNhiWVKLDG1kOQRUxfGffq3JjrykmcvEbo1TmratuWZ7ml 3+JPOYpoqxjEPOf66ZqVj9Zw/yMH8qSKO+RAkYt+pSL4TjaL2eZnHefZZNqne09HLTIV nMhNSwaG7eDRhymesSd7lOGCjLzdemsYweprENKqHuDmdhImLQ2pC44+05Szoc5knKuO kQ+QmooGDtgWsKXWY6QIV9/KBbZzYlvOPk0ZDDEpxdMsYf4AY4auUOFuo6TwS87mKNXU 1n2DcxQ1LQURaKkTg/Lbfp3bh12/eY1VSdXHkZuJQZsHiSHXiADNGDsU4GbCopKt+rA1 bFvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=FAWe64W2NwnFAQiXHeHZ8EMU8gr37Jq34GIw0wUlRAI=; fh=T29NK0a2UgpyPMJNdRdxOwtTMCeLNbJCj+OzYaaxEOg=; b=0P6KAMCcqj4PYd6sr0A1UvocpcuwkzXTwe1K7gK/DRA/ZSh++uqs2jHDxSlj6Kq33J 5KAX7fR+RZOQCzLCqHvNLYWqbDpHHsMY5je35aOZgukf5eqCF6ToAwlArS6bx66YxDkg BTYu6OCmA1q2pLr0s8anen6U9WHWcpiBllOu7N4u9wbS3zMhAK07SM4p305csOdv8/EZ 32xBpz2TPQUcTP40mK08fCwSAHGmZqEXomCaB0tVKJEe1P0Kwat9QblxwE+MmXZdWPt4 KxITX31wiQDWJgo0TYEf2ALRubVthW9J3S0xg7YwRu6T/vuLZAtQYlcnmoQPTFFrZxqV wdKQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FBRjGuiz; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-44334-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44334-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n9-20020ac85a09000000b0042b96879c1fsi353561qta.671.2024.01.30.02.01.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44334-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FBRjGuiz; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-44334-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44334-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 900561C24958 for ; Tue, 30 Jan 2024 10:01:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55A516774F; Tue, 30 Jan 2024 09:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FBRjGuiz" Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D16766B34 for ; Tue, 30 Jan 2024 09:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608626; cv=none; b=CnwtDRcrRxXhKT46oXAGFCZcem/Nw1xOqb7Z5F5Zi5U+F76s3+5E4M+Y1z4frlEkdmAWxmhFdIUXIUugZ6g1eYuU5ycE8w0AJYIHN2CJw/GPk5LYzO9yc4VX6PRgL16w89fj653+5ZzUxS+f6oRpTbZ+iYI7H5A44HoHJ77rQbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608626; c=relaxed/simple; bh=DZ/v2H4uuaEQcj7bfKz1fgk00itGWaWjpueC+N1wZt8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QnEqDogdYX4HiQV+0AZvux2SVvM/Ks+3eoworcFMs7N6ZFmNErCms9Ofr+UA5Ak2GcBD9rmpaFey8oWOfWwKGCUOC4cVnWOmC8tz/atgBT12VhOkRPaTZuKGhXGTFUq47YbHmbMrvuQkX4PAfzUqOIn6Lk6Fy+OzX+hIY6qbFFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=FBRjGuiz; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5d8b519e438so1620655a12.1 for ; Tue, 30 Jan 2024 01:57:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706608624; x=1707213424; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FAWe64W2NwnFAQiXHeHZ8EMU8gr37Jq34GIw0wUlRAI=; b=FBRjGuizXSJu3e8vLLKGziuYE4iXIt8+434d444FTfItnoobx2Xpz5s19yUh40mr0L Zuv9B1ScIgx1xDoaQn+wwpjjWo/DgK1iYAGEoYHovs9/iuyzh+68uSQ3jRMMLdIL1jqd QJLJbGmMil+mx8kAoBUo2siI3dt3pVKRIZqO8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706608624; x=1707213424; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FAWe64W2NwnFAQiXHeHZ8EMU8gr37Jq34GIw0wUlRAI=; b=p0E3UxpaaPMWLqS5MxSun4o9CgZXOOPLwJVXNf5LF/uKeWfDdLMze0jvb82hiLUrls UgHUUOQ/eNTFCQI3YbsRsDCRH8yeynCs+AyUkyQYyL7eVHZlNnwkYM+y7rDIFeaiBu/f NwLJ73MAZzDwDpSfaZiFCZCxlWxjQUithbSDPX8lExpty8qnpOFUFqZ5PODYr3922aob J6eMk6zqu1yISpNpdGOKQ4FDcRBeCSStk+ydhMhO8aKeo/LYhHFmlPuINkCskofYqEUw c6Pqg80NEm/L4mGgypDizgw/DAPi6gZM2S4p2lQe8j3sOAmjs/Co1nWNZmWQP3+ofJw2 vLYA== X-Gm-Message-State: AOJu0YwFB1Pe/3G1z6CujF8DnuHmeM4NPhzBEF4I2KWwoFZqIYfTbkrt ZFWxh5mZ0HcQYzGYaySLzPP7HejigyvWoweDy3sS2BPZGXTdZJB7zLTA6vZ+sg== X-Received: by 2002:a05:6a20:2d0f:b0:19c:a389:dd6b with SMTP id g15-20020a056a202d0f00b0019ca389dd6bmr4272695pzl.20.1706608624676; Tue, 30 Jan 2024 01:57:04 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:469:110f:d748:6896]) by smtp.gmail.com with ESMTPSA id sm5-20020a17090b2e4500b0028ffea988a2sm8069810pjb.37.2024.01.30.01.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:57:04 -0800 (PST) From: Chen-Yu Tsai To: Matthias Brugger , AngeloGioacchino Del Regno , Srinivas Kandagatla Cc: Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, William-tw Lin Subject: [PATCH 2/3] soc: mediatek: mtk-socinfo: Add extra entry for MT8183 Date: Tue, 30 Jan 2024 17:56:52 +0800 Message-ID: <20240130095656.3712469-3-wenst@chromium.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240130095656.3712469-1-wenst@chromium.org> References: <20240130095656.3712469-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789509152674390710 X-GMAIL-MSGID: 1789509152674390710 The MT8183 has another socinfo match, with the second cell only differing by one bit. Add it to the driver. Fixes: 423a54da3c7e ("soc: mediatek: mtk-socinfo: Add driver for getting chip information") Signed-off-by: Chen-Yu Tsai Acked-by: William-tw Lin --- drivers/soc/mediatek/mtk-socinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/mediatek/mtk-socinfo.c b/drivers/soc/mediatek/mtk-socinfo.c index 3909d22062ce..42572e8c1520 100644 --- a/drivers/soc/mediatek/mtk-socinfo.c +++ b/drivers/soc/mediatek/mtk-socinfo.c @@ -45,6 +45,7 @@ static const char *cell_names[MAX_CELLS] = {"socinfo-data1", "socinfo-data2"}; static struct socinfo_data socinfo_data_table[] = { MTK_SOCINFO_ENTRY("MT8173", "MT8173V/AC", "MT8173", 0x6CA20004, 0x10000000), MTK_SOCINFO_ENTRY("MT8183", "MT8183V/AZA", "Kompanio 500", 0x00010043, 0x00000840), + MTK_SOCINFO_ENTRY("MT8183", "MT8183V/AZA", "Kompanio 500", 0x00010043, 0x00000940), MTK_SOCINFO_ENTRY("MT8186", "MT8186GV/AZA", "Kompanio 520", 0x81861001, CELL_NOT_USED), MTK_SOCINFO_ENTRY("MT8186T", "MT8186TV/AZA", "Kompanio 528", 0x81862001, CELL_NOT_USED), MTK_SOCINFO_ENTRY("MT8188", "MT8188GV/AZA", "Kompanio 830", 0x81880000, 0x00000010), From patchwork Tue Jan 30 09:56:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 193944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1110368dyb; Tue, 30 Jan 2024 02:02:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTwzYHkXv+HI57UnXhQ9E/uC3gU1I5SCfihqzeyHALVBTvE5o5gS0Fp+kpyfHPbfV3gA9O X-Received: by 2002:a05:622a:509:b0:42a:5862:ec2b with SMTP id l9-20020a05622a050900b0042a5862ec2bmr995011qtx.25.1706608930688; Tue, 30 Jan 2024 02:02:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706608930; cv=pass; d=google.com; s=arc-20160816; b=FF3ZhJ7L73svYrc9Yz9OOun38Wk9Wll80gOKmAnHsdwuioWA9nee/HtNd1DUzI2B8L mkJ5S0WXrU1X/oZWRiQ03GJTyls0aJv+uWi1mT6UW9GS/+8NkCV+bmd3um6dAhiFxUkX MsW3WUTqbEsOO/TzBgKY41oNWUcnVM8cVDUIoTnD/yJPF7yjp4LpN65oQNbqHBraPyyd 0/D7Ihrw3ts+BSQtLTH3NjoMFEr14HJ1nmfx9nz3w4S7je4bnuh2lTBRcIz1cWgV5I6e rFfl1hNlWNVu18iBIFBIoH0LVofw/+WxSYLY87Y95H4NIoFrPWKjajZOX4O84pKhRTGQ 8qGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gdC3n49f3pUPNsrcBA7Bt2BGENrWBIomL/x/RasR6Lw=; fh=T29NK0a2UgpyPMJNdRdxOwtTMCeLNbJCj+OzYaaxEOg=; b=RMc8egox6VLEtvdJC49MO6mrWi8jS2oAZLCFPoXqVdyxIamgDPneM02Fw4H/YdtY1P ilhwAZM2Ui0Oon9cQ4DIvUx4lm4EVsq1ApMWcUDivfcNGeaDOB9BhzMltYv5w+zRhBoh Gg2ca5uVBbrH3ZT11GdIJ5cSY+4qXmV1GQ6n7rc0J27bkedqzL77Jzws9ZlFwdsdQ0KG bZlVj718PGfUBsIVvHaezZCW/Ohh9cW59KlE5pPXvAlJHopdiGFK7zdMBpORrKRk9Ds4 zhxNeNdrp5L4OUITChUqsZ6IrRy8eIFKwp15lM/Ezf+lE1IBXyc/Tl/Y/nksE2Nf5HBQ U+WA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=arOvOHtO; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-44335-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44335-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c11-20020a05620a164b00b00783f21c1280si6353271qko.507.2024.01.30.02.02.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:02:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44335-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=arOvOHtO; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-44335-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44335-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7AC321C23CE0 for ; Tue, 30 Jan 2024 10:02:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75E996D1BD; Tue, 30 Jan 2024 09:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="arOvOHtO" Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 725FC67739 for ; Tue, 30 Jan 2024 09:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608628; cv=none; b=EW14FoptPLzQlfQhvWYBkfqwt1lcoqeqZJgdyU2z4IOujJakGi+gf06aPXfo5PbzdkqHvwWzCWbgCAbS0TczIrNMk5ExwNEB1/N5nBQL3msBBTYrrUA6AiqZ+u9G4FB8T8NyCSzvjeO8Sdg6a+nH8gZNk/0zxyjwcvmTbhbmiTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608628; c=relaxed/simple; bh=PjLNZGOK4cojVlDhXj8cggrO1CsQ4u8l1duSGG978Bo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EYkA9KfJVpwVp/yVhF6CqEZVlCTmLjwNHQq8Dfc66Ttkx+7grUbhGu7sQONxIBPAA99be8JoFPHJrlyoN5qqzwcYj81Ur3Unyxv48/GB8kOAliHURj9xAND1odag7LFua3w0vfEOpoJRONrQennVzhjSX+wfpAxx0dCjH/6tFyM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=arOvOHtO; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2901ceb0d33so3553651a91.1 for ; Tue, 30 Jan 2024 01:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706608627; x=1707213427; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gdC3n49f3pUPNsrcBA7Bt2BGENrWBIomL/x/RasR6Lw=; b=arOvOHtONb2E51YRGSlT/H6dFpxETt36r1dKYJzVpEyMf5vDtG9InBYf7KAoEE+G1d oRVJiFszU5u8kZEu9WATRXzhnt/Xe46soqRWVHUuMHsKf86mR/yhdM75Hr1/xI59Z0Qz FKXkTaFT5RwrUYUOqITq01ORHBrNxUhjJphnM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706608627; x=1707213427; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gdC3n49f3pUPNsrcBA7Bt2BGENrWBIomL/x/RasR6Lw=; b=pRf6hDstuFnanddHwVTwPrJ6z18oKw8KlHAg6DVBO4AKOpc90VDlEGrSWEsMWB/Zg8 dx0co58DP5vOkVxG2v0K4PsVQXLkJig9fGwKNvb1dgh7iakKhC6WN/V/xJvg7OFvhrb8 6ug2M/TPfGm0uCrFqXWAtKHqHT5rtTsQFd6ysrKT6aIGgxMBqKB6Jkz8YrQgHZ/aOIY9 SSauu/GSfzNF2d7Trg1scRJ5vS9xZfdVqtSIlh2RlmsEIiJsvk9bC4crQy40Hr/VhcLo 8plv3SMD5iVIxEYiHajtRBufkC1PPinA1kUXSKEWfs3217SZe8XK63XicVGA4GHzkYJ/ m88Q== X-Gm-Message-State: AOJu0YxXOPSzOB3YMQjdK6jUWZTPfwu0Da+M8RNIfITXJkeefPB+b3it skRkn5ABLod1xlSbmHUtNUidgGRItajnHpaFDcAgCQNVbGrLwROcDo7Rj1fKWw== X-Received: by 2002:a17:90b:696:b0:28d:1581:29e6 with SMTP id m22-20020a17090b069600b0028d158129e6mr1136268pjz.13.1706608626736; Tue, 30 Jan 2024 01:57:06 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:469:110f:d748:6896]) by smtp.gmail.com with ESMTPSA id sm5-20020a17090b2e4500b0028ffea988a2sm8069810pjb.37.2024.01.30.01.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:57:06 -0800 (PST) From: Chen-Yu Tsai To: Matthias Brugger , AngeloGioacchino Del Regno , Srinivas Kandagatla Cc: Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, William-tw Lin Subject: [PATCH 3/3] nvmem: mtk-efuse: Drop NVMEM device name Date: Tue, 30 Jan 2024 17:56:53 +0800 Message-ID: <20240130095656.3712469-4-wenst@chromium.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240130095656.3712469-1-wenst@chromium.org> References: <20240130095656.3712469-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789509165963044502 X-GMAIL-MSGID: 1789509165963044502 The MT8183 has not one but two efuse devices. The static name and ID causes the second efuse device to fail to probe, due to duplicate sysfs entries. With the rework of the mtk-socinfo driver, lookup by name is no longer necessary. The custom name can simply be dropped. Fixes: 4e6102d60d88 ("nvmem: mtk-efuse: Register MediaTek socinfo driver from efuse") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Tested-by: NĂ­colas F. R. A. Prado --- drivers/nvmem/mtk-efuse.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index f5bebcecf9bd..9caf04667341 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -86,7 +86,6 @@ static int mtk_efuse_probe(struct platform_device *pdev) econfig.size = resource_size(res); econfig.priv = priv; econfig.dev = dev; - econfig.name = "mtk-efuse"; if (pdata->uses_post_processing) econfig.fixup_dt_cell_info = &mtk_efuse_fixup_dt_cell_info; nvmem = devm_nvmem_register(dev, &econfig);