From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752054AbdBOOdP (ORCPT ); Wed, 15 Feb 2017 09:33:15 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35022 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751518AbdBOObi (ORCPT ); Wed, 15 Feb 2017 09:31:38 -0500 From: Andrey Drobyshev To: linux-kernel@vger.kernel.org Cc: gq@cs.msu.su, giometti@enneenne.com Subject: [PATCH 2/8] ntp/pps: ignore pps_valid decreasing if there is no pps signal. Date: Wed, 15 Feb 2017 17:31:03 +0300 Message-Id: <1487169069-15721-3-git-send-email-immortalguardian1@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1487169069-15721-1-git-send-email-immortalguardian1@gmail.com> References: <1487169069-15721-1-git-send-email-immortalguardian1@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander GQ Gerasiov In case pps_dec_valid() is called from second_overflow() in the absence of pps signal, there is no need to decrease pps_valid. Signed-off-by: Alexander GQ Gerasiov --- kernel/time/ntp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index d20891e..22f2235 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -154,6 +154,10 @@ static inline void pps_clear(void) */ static inline void pps_dec_valid(void) { + /* Silently ignore if PPS was not turned on */ + if (!(time_status & STA_PPSSIGNAL)) + return; + if (pps_valid > 0) pps_valid--; else { -- 2.1.4