Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4831108imu; Wed, 19 Dec 2018 00:42:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/WVX+NhhbDUNa9r8NGMHI2jVNzkWcK2xKromoe16lkHYI2RKhFiMGA/3vYzwixxWMJV4Obk X-Received: by 2002:a63:1904:: with SMTP id z4mr2117132pgl.135.1545208962385; Wed, 19 Dec 2018 00:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545208962; cv=none; d=google.com; s=arc-20160816; b=T4O5FcnZVPrPJbiLFvqb3EigTBqZkD9MLJa2i5wEian6+OzVgVT2wumpdWNqRYJIlb JHaekS5hYHd0i23cQA3K8VhG/X1XBYDxYXEEaELTF8y9amskvOOjZXJbfq/airJ3kJ3B QK2IgKQC6X+PVmFZDXmor/LPrTNbd2GrC41FFHMzwiis6Kt/CwWAIB5Yo6gTjNVy6Etz bPSKjN2KYvyvFsAnSZnE3ESSUaoGwUqv9Huu+pwaH+3DX6Q6X06sHlOfjB5RasmArHNJ BiJGAAcXsa4eHKpHZaaZ26mST34H7AZKZrzC104idy31bLbhr3GWRcDjed4Q4GNvQMJ3 0paw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:message-id:date:subject:cc:to :from; bh=iTNxSjvQJ/FEBYOt+RcQZQR95WGBFi/0hbaMGhWpv/A=; b=ZHjq8860dbCu/YiPE/P827kbFwFiSpAgHAivio4OGbD4z+c/h2OFoP+H1nq6yOQjpq ByD6GkmprLyAWmD1l9vU/UGpp3AAaorg0xwsuA/sbFNNETuEN84uBNd3CojgzLc+tLTS eBy7/w0G6MvfxW+RttpDtSU98aElMoyoEyoggsNMWhpTakFqDarmhcAMm+DeSaBURufY pYRK1ptMh4z9FYATNabSUCUaK0Yp9X8RfCtkThjbxx4BlYot9IzuvbZ642e8kQh/+t87 R7/+OHyxbiDzs7KH2AEtyuMkv39qnE1mlrJLDbVx225g6VEwIpxxPuccvy7mrJgg6TKc Tivg== ARC-Authentication-Results: i=1; mx.google.com; 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 c136si15690990pfc.141.2018.12.19.00.42.26; Wed, 19 Dec 2018 00:42:42 -0800 (PST) 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; 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 S1728282AbeLSIWq (ORCPT + 99 others); Wed, 19 Dec 2018 03:22:46 -0500 Received: from smtpbg321.qq.com ([14.17.32.30]:57543 "EHLO smtpbg321.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727721AbeLSIWq (ORCPT ); Wed, 19 Dec 2018 03:22:46 -0500 X-Greylist: delayed 450 seconds by postgrey-1.27 at vger.kernel.org; Wed, 19 Dec 2018 03:22:43 EST X-QQ-mid: bizesmtp22t1545207302tyfesoyl Received: from software.domain.org (unknown [222.92.8.142]) by esmtp6.qq.com (ESMTP) with id ; Wed, 19 Dec 2018 16:14:57 +0800 (CST) X-QQ-SSF: 01100000002000F0FG42B00A0000000 X-QQ-FEAT: FRkVFvYdryUwci0fG4Rp91xRGhz0N1J6Ls26DjcnUqiFsh2sFOobAJ8IswJ8T wh0+apxGDflxofdRiDL6lshOFANtLApP4aWkIQYF3E+GUPehwEvPBwxMPiGutgzhNBK+xvw 4+cBh3zDP08pqkbRXWvuF/F6ND75DWZtmOw+7eAk/FyFMpEXbwv+zFmsJb18uS2GRzfaFLU JfOOv6o5sR6crXk8+Yot0qB4R407MvoPt43m/0uDTZY1ZExYQb97skQK27uVGnpNIMaJ5ls Gv5/2kZsA7sW3a+pUtr7lrRfsMW6s4V/pV7w== X-QQ-GoodBg: 0 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 , stable@vger.kernel.org Subject: [PATCH V3] cacheinfo: Keep the old value if of_property_read_u32 fails Date: Wed, 19 Dec 2018 16:16:03 +0800 Message-Id: <1545207363-7402-1-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:lemote.com:qybgweb:qybgweb2 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. Fixes: 448a5a552f33 ("drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number") Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Reviewed-by: Sudeep Holla --- V2: Add Cc and Reviewed-by V3: Add ChangeLog 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 cf78fa6..a735953 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