Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2342484imm; Mon, 28 May 2018 06:24:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQQLtwvp2SdSXOgR6H5x/Q6372KDev16G8BIoV3jyjLTk/Dp9JsG7hnck2o4EUtqqdd0sy X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr13907800plk.256.1527513843783; Mon, 28 May 2018 06:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513843; cv=none; d=google.com; s=arc-20160816; b=CXPX3dXQJhGK9jP8jDan+0KQDF/Nlf1Ku+u4o3xKPAYZuejhS82x+Pc46yzKtTjadh BuQC3aCh6WS+xj2dGiAPuC9i27KdDegj8Y4JRWJeWdw1Xte4wPqYoNC/ZnhpssVQYM+C iYZ5j9HxH9k76jhZWDkIvnv9XSyIU/+nRJeE1osFmE3JeVBR8LEUn+YowOHrR6DK8vNC mznG8tZLw1zUppqE8XGYFDnW20YpCOMM8YO9ouktBVBRQx8LVbw1L4SLUZtSlRbGt1f3 kWfQx1rVBDY1bzNeUCY7zv3luepHvtByQ4q1OktFlpnGp6BavsknP3HIlj38URZqmERE a62A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=QOgeov+FppqjZTL3BURqb/cEysRYFE+mV6KN/FhUgL8=; b=P8NyygKVMGYlheabfiA3OV0Qck7iZhEiyhmI8YdUPRRycXDgmqQrX9koHsvkK2PssF lcfmnxn2OZl7LYd/rLjrqUTFVQq6wXXw1Iq8a0NA/+8us1clRLCp6XCkcgXeieeJ8RbI Ug3SRxd5CVWAicGSsS85zMXExnsldDiu8Iz8nqANBx8+hVAUFSidtUhMVZFR3fTTYE1N /pxLjXuHP+ewU8QLru+fVikmqlRJ8cinrMG/BhDKF3zPJcvrDKeydLHhoX372jymJqYC uODBXPMm9kWWYkPI8YQeK0m6dfCzzoUE1hEyhShHtZIn/6+EqP3Vu6yNHceWYA9ZSCsr mmdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eaTJwOp7; 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 n136-v6si29528849pfd.312.2018.05.28.06.23.48; Mon, 28 May 2018 06:24:03 -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=pass header.i=@kernel.org header.s=default header.b=eaTJwOp7; 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 S1163580AbeE1NXB (ORCPT + 99 others); Mon, 28 May 2018 09:23:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163423AbeE1Kst (ORCPT ); Mon, 28 May 2018 06:48:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 AA5A120660; Mon, 28 May 2018 10:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504529; bh=kaeq3AlGZD/yFAk8R9PVtUBvrvt2q16TTsRXNdFVJYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eaTJwOp7OjtZc6bFFf7OaccwiL8uv1dqA14nKNOseJ9lON16C5NdiC9m5f7j8VA5x l7OZ1mTMTKRWn2ujt4iVEHoBnZtUNitY1HPWt3a+wbB3CYHOj98BLb1Iajeuh9aHJR 93yTBeTWjtK/ObYsa0LBVE6Q+hf0llwYitqxEWXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Thomas Gleixner , daniel.lezcano@linaro.org, paul.burton@imgtec.com, Sasha Levin Subject: [PATCH 4.14 170/496] clocksource/drivers/mips-gic-timer: Use correct shift count to extract data Date: Mon, 28 May 2018 11:59:15 +0200 Message-Id: <20180528100327.036955288@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Fietkau [ Upstream commit 5753405e27f8fe4c42c1537d3ddbd9e058e54cdc ] __gic_clocksource_init() extracts the GIC_CONFIG_COUNTBITS field from read_gic_config() by right shifting the register value. The shift count is determined by the most significant bit (__fls) of the bitmask which is wrong as it shifts out the complete bitfield. Use the least significant bit (__ffs) instead to shift the bitfield down to bit 0. Fixes: e07127a077c7 ("clocksource: mips-gic-timer: Use new GIC accessor functions") Signed-off-by: Felix Fietkau Signed-off-by: Thomas Gleixner Cc: daniel.lezcano@linaro.org Cc: paul.burton@imgtec.com Link: https://lkml.kernel.org/r/20180228095610.50341-1-nbd@nbd.name Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/clocksource/mips-gic-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c @@ -164,7 +164,7 @@ static int __init __gic_clocksource_init /* Set clocksource mask. */ count_width = read_gic_config() & GIC_CONFIG_COUNTBITS; - count_width >>= __fls(GIC_CONFIG_COUNTBITS); + count_width >>= __ffs(GIC_CONFIG_COUNTBITS); count_width *= 4; count_width += 32; gic_clocksource.mask = CLOCKSOURCE_MASK(count_width);