From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 629E4C282CE for ; Mon, 11 Feb 2019 14:37:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 350C520844 for ; Mon, 11 Feb 2019 14:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895877; bh=rTZyOjF9oNR4eKI2T/jpdjn7bgB3Jr+t9HIM2qEBaYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hXcdI+WVBHrP4Nuo0hoMOck8847tKTw5jm9q8ADSNhI2tL8zIqFLL1Rf6Tea5MhtB 8h4dSx6DMzcpGRiKoVlwVQrk3CFfFOlwf8Htnx1sTfy38Ke4T4lv7crx8Oz/cFgmdr SugBvIS7MpRcPISXfpnUxFfc4PdeWd1e6rzCZiHc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730908AbfBKOhz (ORCPT ); Mon, 11 Feb 2019 09:37:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:47370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731538AbfBKOhv (ORCPT ); Mon, 11 Feb 2019 09:37:51 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 325D62081B; Mon, 11 Feb 2019 14:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895870; bh=rTZyOjF9oNR4eKI2T/jpdjn7bgB3Jr+t9HIM2qEBaYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udYAv77/MJebCdLxJWBYFRerYpgM2F9U1iLP7EKlkDuV6Gb/MQSy5WzC4DGL7SMe3 E86vIhOL5+h7shHU3aRi8Qy00xRiunjTrsgE3Z5MTaaLuR9ApcXZHIgBPZn/BeGMEl 3rK52lRdvDS0KNbmc/31f/ivDEJ7bbfqUIA4OTkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Sudeep Holla Subject: [PATCH 4.20 351/352] cacheinfo: Keep the old value if of_property_read_u32 fails Date: Mon, 11 Feb 2019 15:19:38 +0100 Message-Id: <20190211141909.503574592@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Huacai Chen commit 3a34c986324c07dde32903f7bb262e6138e77c2a upstream. 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 Signed-off-by: Greg Kroah-Hartman --- drivers/base/cacheinfo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo 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 cachein 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)