Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752260AbdDCNFB (ORCPT ); Mon, 3 Apr 2017 09:05:01 -0400 Received: from webclient5.webclient5.de ([136.243.32.179]:38153 "EHLO webclient5.webclient5.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbdDCNFA (ORCPT ); Mon, 3 Apr 2017 09:05:00 -0400 X-Greylist: delayed 583 seconds by postgrey-1.27 at vger.kernel.org; Mon, 03 Apr 2017 09:05:00 EDT Subject: Re: [PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt To: Corentin Labbe , arnd@arndb.de References: <20170403121559.1397-1-clabbe.montjoie@gmail.com> <20170403121559.1397-6-clabbe.montjoie@gmail.com> Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org From: Clemens Ladisch Message-ID: <64bd824c-2d09-3c8c-d35d-06d3808713b2@ladisch.de> Date: Mon, 3 Apr 2017 14:55:14 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170403121559.1397-6-clabbe.montjoie@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 840 Lines: 25 Corentin Labbe wrote: > This patch fix the following warning: > drivers/char/hpet.c:146:17: attention : variable ‘m’ set but not used [-Wunused-but-set-variable] > by removing the unused variable m in hpet_interrupt This patch might silence the warning, but it leaves the bug that actually caused the warning. As far as I can see, the computation of "base" should use "m". But the entire algorithm is completely bogus because it does not actually remove the race condition; the counter is likely to have advanced beyond the "mc" value when the new comparator value is written. Also see arch/x86/kernel/hpet.c for how hpet_next_event() handles this. And why a non-periodic timer should generate periodic interrupts is another question. And nobody uses this crap. So I'm really not sure what to do about this ... Regards, Clemens