Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp83381imm; Tue, 16 Oct 2018 18:28:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV63611bqK+yt1UNrBLYXfWB+CFsLP8fLsFeXWUUVaimlgze3pHVgqJ7spNYsrRYwaaf1L5cj X-Received: by 2002:a17:902:2e81:: with SMTP id r1-v6mr17833837plb.212.1539739686587; Tue, 16 Oct 2018 18:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539739686; cv=none; d=google.com; s=arc-20160816; b=YaIqTUN/9v9hBRjSqEPiA/0Ks6wL4MtODirH4cCAYjEjwE5yxnZJdUJkvZXvB7itQX uhW/RlzNs3vhspUfjWGqSno8JzDCBSIufGuS3lt1JwdLc3xa0D6qNoIszhIwcFtbmIpz dKTxMgPv7SHuYeh1P9TxHq8yRM4Ml6sn4yhEWpac0GL8evbRHHU0OoxPhfK0kyu7G6jX KDBCnpNIIV/BaIKZO/oizvsYvR2E4GpMUMirEnVTHrxM9M633jBXvulGF2CCgHcWdgVi KxzuKdM0faXI/8Le+Rq7YrzLnlPXVoGf+erIceu1ELIAblffFqBKRLVJO5V3iVRES7PK zt3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=CS8dgnIFpYQ7Enn0sLvT3ctTvSkag//XEF+SGM30/ik=; b=0lz89MwY8qz6oQDcAL4Abw2xszWCjvNFS0NfWYF97WMGAiJsZxISJ1FHpzFJHaOais KPFtmwElwIYaaX2UNlVaZEwhShE8Qj3Z1FjR4EUsvLFOL+1xyKp93xmAFCuYUol+h+Fa 7zHRqR491str4O1+uwnxI8DfNSct3unriE2lZL8EyZ0K+1smL1KzQ7JLTvlHFIbDYxe6 n4NRx6WtgnJRmS4Vms7Sr0tbhqNZwIr80QahTrO/0h6ASk2axpVaS2cYW3ldCDfJ9q/Y /6KXzoItbQdO53papQbJA5+zXyXRX2gRGlmWk58n0SISbiABv8olLpJLvfFFZYQlXeF4 C90Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="V1iqE/b7"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si15446681plk.95.2018.10.16.18.27.50; Tue, 16 Oct 2018 18:28:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="V1iqE/b7"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727262AbeJQJTV (ORCPT + 99 others); Wed, 17 Oct 2018 05:19:21 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33083 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726936AbeJQJTU (ORCPT ); Wed, 17 Oct 2018 05:19:20 -0400 Received: by mail-pg1-f193.google.com with SMTP id y18-v6so11707214pge.0 for ; Tue, 16 Oct 2018 18:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=CS8dgnIFpYQ7Enn0sLvT3ctTvSkag//XEF+SGM30/ik=; b=V1iqE/b7mbZxVebrEW2TwdC1dnfGW++tJFxMWQF7YcYDpKpnUhl7UJd4ExRPNKXYsv NxCbufA92jY0tk0r+zM888yvi5IRd7P8mT3AlIrRDwTaA2MtVQhjgTt8b6sZaELUtXCc 1mzpmtefGlUUaOfh/iPsFIkFw/YYoanuR7FSsmOfaEN6Arb6fKxEAtgCVi0e2RJiRbEe vTJZHkNjCv9mAXNdZmqXtyuCXBc75v5Z5bSqAXNwhoisQ+fuc2emxEHjFPEyNnv0LPvo mhMlLD6ptw9djq/wTjEmEj24CmoAapKuhabv6RcVFqvHP66YZayK75FF1vOZqd4DwzUI Cjqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=CS8dgnIFpYQ7Enn0sLvT3ctTvSkag//XEF+SGM30/ik=; b=Lemi9D8RkF7zJxP5kqhd1KhIGqyJPMNkl+nS4+jEsM2YpLtGV5FnJX0pO3u1rkK0SI 7r+OBsH5tldSlDuqJ688+0ByJ4UhC0fw9E6bmiweSHg6lkJlfViWjBMLE6A6vlJAjxLk SqVnmNxfV/qMqkpALUUoeF0Bs3MBefzK2vzcJDuaEQkLXP9pjDkJpqkHTNQWIo4stHnw tFQ4ZV6+x35Vs0T1mmItTHFqpRWklTOFnbssm4515WJwbgZRe4Y5S1kv0XaEgkm/uUPo 6W0etoAumg8ynoYBNtqqd6G81IFBSghX3kH6Tx1tXrtIhE6ZGL9D+DdQ98y/KaI0AY62 MlXQ== X-Gm-Message-State: ABuFfojRycMzhH4qoMlNV+LSGLlAYINPQHwQr8lRx5r/4Bx942HutGEQ c5nE6J9u5juIbIetmTSEdCk= X-Received: by 2002:a62:210:: with SMTP id 16-v6mr25316117pfc.100.1539739570220; Tue, 16 Oct 2018 18:26:10 -0700 (PDT) Received: from software.domain.org ([172.247.34.138]) by smtp.gmail.com with ESMTPSA id t85-v6sm24126389pfi.73.2018.10.16.18.26.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Oct 2018 18:26:09 -0700 (PDT) From: Huacai Chen To: Greg Kroah-Hartman Cc: "Rafael J . Wysocki" , Sudeep Holla , linux-kernel@vger.kernel.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen , Huacai Chen Subject: [PATCH] cacheinfo: Keep the old value if of_property_read_u32 fails Date: Wed, 17 Oct 2018 09:26:03 +0800 Message-Id: <1539739563-1886-1-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 448a5a552f336bd7b847b1951 ("drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number") makes cache size and number_of_sets be 0 if DT doesn't provide there values. I think this is unreasonable so make them keep the old values, which is the same as old kernels. Signed-off-by: Huacai Chen --- drivers/base/cacheinfo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 5d5b598..dd6a685 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo *this_leaf, struct device_node *np) ct_idx = get_cacheinfo_idx(this_leaf->type); propname = cache_type_info[ct_idx].size_prop; - if (of_property_read_u32(np, propname, &this_leaf->size)) - this_leaf->size = 0; + of_property_read_u32(np, propname, &this_leaf->size); } /* not cache_line_size() because that's a macro in include/linux/cache.h */ @@ -114,8 +113,7 @@ static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np) ct_idx = get_cacheinfo_idx(this_leaf->type); propname = cache_type_info[ct_idx].nr_sets_prop; - if (of_property_read_u32(np, propname, &this_leaf->number_of_sets)) - this_leaf->number_of_sets = 0; + of_property_read_u32(np, propname, &this_leaf->number_of_sets); } static void cache_associativity(struct cacheinfo *this_leaf) -- 2.7.0