Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1412075ybi; Fri, 14 Jun 2019 14:26:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaTQu9Pmm1sut50pGbM9MnqX9INPWrfLAyv+/KLzc1hfCHVjThJgPt2FsQ2PEzqTpTBIqM X-Received: by 2002:aa7:8752:: with SMTP id g18mr28653978pfo.201.1560547589960; Fri, 14 Jun 2019 14:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560547589; cv=none; d=google.com; s=arc-20160816; b=k8gk8EYSxpxi3lthfjoNp55V7x7qGwet1Y+qjFNV9ZkHQXn7noQ1Ep2VHzR7fnuo7m wvR7K3b8KjP+/3hF0anByXwjYI/ke3DC/ZNRQZ6LkjtbtSX3RjM4Mnv9KtzX20rQxAr+ ept+ieFGR5sNpY+jAKh5JMbGJmDDN2+NUththuE7APMS4QfGKxywK9nz5KWp8DBx8pR2 4yOl/5fDVYYTsxEqBp+qCfc8mkz/Argzu7tNjyn/1r/diXspeCLVjd6oJJOIf22DXwwt N17zPnNWJR6uB3O5xt7ZknemmmWxjm8qkb3ge+8EvBEAZGcCJoeR5pBUuiyUekg+itDD v3NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2A4ly2dcH9ZC/oiZsEF8IXrnQBbAt0kcJ8C4LRUG9V4=; b=Y2YyqnMhfz3n90XznOA6YFp+yc1ROmtU6vFUfutFLqDaqNvfkYSEo84O+66MqadC16 8T/rG5OCIqosURSCr3ReJy+Ja2kYeiybomP1ZH/6U/EWilqBH9TCMybA+0+YZNnuG1qD 2UcG7O9d/dzBHI6jsWIWGi/l1c2gSMlpM+GoT7FAdRc6c11otQNDWErFo7vEswQCViJD Ip1gijP64zEY0zIOZbvo5paUeTYASlvL8SBiJUZf4azZ7Jy+LArI+ou8qUu5cBIiJZ1K xb8pdX+SRtpRudUgCbhp08TlpPsw42obEYVi7yzPmBeFaJ0/IPt8c+024h1T/NAPiq3U bOVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QfV3WUfs; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g31si3070510plb.241.2019.06.14.14.26.14; Fri, 14 Jun 2019 14:26:29 -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=@google.com header.s=20161025 header.b=QfV3WUfs; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726692AbfFNVY0 (ORCPT + 99 others); Fri, 14 Jun 2019 17:24:26 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36203 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbfFNVY0 (ORCPT ); Fri, 14 Jun 2019 17:24:26 -0400 Received: by mail-pf1-f195.google.com with SMTP id r7so2152876pfl.3 for ; Fri, 14 Jun 2019 14:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2A4ly2dcH9ZC/oiZsEF8IXrnQBbAt0kcJ8C4LRUG9V4=; b=QfV3WUfs1QILx1Hg76mwH6v9g/+9dA7MqI+okQQpMpHT1jEXRYkvGxgbhK/Cpw4XNv HmN2vpYMI8vSc5sx+7b2xh0g3ibrle5JD44P6jStLr1jeru2SdnUC+xfOugB3SNtGJig XWPWJrnu9Ot70Y2+6PwFPvSV6h9GVD7iKCv2NMGuT4DkgtPTOOrIktz1DPOuHFCxjWX7 5HWCX+Pyo1fYOxnsTXulwAFvnFMqvoXaZMkzNlQsKybcZ0ViszEtaK3tAOJSLYPnz4qS KCbo5jmoXR8IiJm8EKfUq6ec7lfjubZI/WN0IiGgJOVuYREpRyrxfqf7r1GBoS5BdNfZ +jTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2A4ly2dcH9ZC/oiZsEF8IXrnQBbAt0kcJ8C4LRUG9V4=; b=rNWxcrhEtuT3S3Q3mcbpsRGtwCQcOpBAICpX/qfIWeLxB9x6QaT3Noesa0vtZaNYdO dgBTavXnIdoFAygr/ShsDwx8wC8ohn9OBltBZLi4xb+nYnfiQZ84xh8cRNe4bz2cA3Go DqxjIYQsVa6hv5+UJPx1NyPUN7B7j1OXVA7BdgdEFWZLHpjyMhetZZHNY6pZmbNc1zkc HfdZbwhGU2wtxe83XRbUldRfu0pMg8d9dIy214nmeo/BhOWgQuOnKn2KHzOyj7P3MlLH dimTFTwxFfQumm8Naa//4iVBYn3+yUWY6PAbqSjHM/U5vAJ3gDa/EMfkXdhA93OKIHay SAzA== X-Gm-Message-State: APjAAAVK3o0x1ZlR0+JsPX+GyUfP6mqoAg5XQc8PQljcIEjE2BXZSHm9 vdvoiY2v1yFivk+GE8Ypw2hQS2g9ZmnScBhxPg0GWQ== X-Received: by 2002:a62:2ec4:: with SMTP id u187mr99487707pfu.84.1560547465571; Fri, 14 Jun 2019 14:24:25 -0700 (PDT) MIME-Version: 1.0 References: <20190614181604.112297-1-nhuck@google.com> In-Reply-To: <20190614181604.112297-1-nhuck@google.com> From: Nick Desaulniers Date: Fri, 14 Jun 2019 14:24:14 -0700 Message-ID: Subject: Re: [PATCH] timer_list: Fix Wunused-const-variable To: Nathan Huckleberry Cc: John Stultz , Thomas Gleixner , sboyd@kernel.org, LKML , clang-built-linux 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 On Fri, Jun 14, 2019 at 11:16 AM 'Nathan Huckleberry' via Clang Built Linux wrote: > > Clang produced the following warning when using allnoconfig > > kernel/time/timer_list.c:361:36: warning: unused variable > 'timer_list_sops' [-Wunused-const-variable] > static const struct seq_operations timer_list_sops = { > > Code reliant on CONFIG_PROC_FS is not in ifdef guard. > Created ifdef guard around proc_fs specific code. Specifically, it sounds like proc_create_seq_private expands to an empty GNU C statement expression (not sure why not a `static inline` function returning `NULL` but ok), so in that case, this object full of function pointer, and its pointed to static functions (whose sole references are this object) all become dead code. > > Cc: clang-built-linux@googlegroups.com > Link: https://github.com/ClangBuiltLinux/linux/issues/534 > Signed-off-by: Nathan Huckleberry Thanks for the patch, looks good! Make sure to include reported by tags when someone else has reported an issue that you fix, in this case: Reported-by: kbuild test robot Link: https://groups.google.com/forum/#!topic/clang-built-linux/w27FQOTlb70 Reviewed-by: Nick Desaulniers > --- > kernel/time/timer_list.c | 36 +++++++++++++++++++----------------- > 1 file changed, 19 insertions(+), 17 deletions(-) > > diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c > index 98ba50dcb1b2..acb326f5f50a 100644 > --- a/kernel/time/timer_list.c > +++ b/kernel/time/timer_list.c > @@ -282,23 +282,6 @@ static inline void timer_list_header(struct seq_file *m, u64 now) > SEQ_printf(m, "\n"); > } > > -static int timer_list_show(struct seq_file *m, void *v) > -{ > - struct timer_list_iter *iter = v; > - > - if (iter->cpu == -1 && !iter->second_pass) > - timer_list_header(m, iter->now); > - else if (!iter->second_pass) > - print_cpu(m, iter->cpu, iter->now); > -#ifdef CONFIG_GENERIC_CLOCKEVENTS > - else if (iter->cpu == -1 && iter->second_pass) > - timer_list_show_tickdevices_header(m); > - else > - print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu); > -#endif > - return 0; > -} > - > void sysrq_timer_list_show(void) > { > u64 now = ktime_to_ns(ktime_get()); > @@ -317,6 +300,24 @@ void sysrq_timer_list_show(void) > return; > } > > +#ifdef CONFIG_PROC_FS > +static int timer_list_show(struct seq_file *m, void *v) > +{ > + struct timer_list_iter *iter = v; > + > + if (iter->cpu == -1 && !iter->second_pass) > + timer_list_header(m, iter->now); > + else if (!iter->second_pass) > + print_cpu(m, iter->cpu, iter->now); > +#ifdef CONFIG_GENERIC_CLOCKEVENTS > + else if (iter->cpu == -1 && iter->second_pass) > + timer_list_show_tickdevices_header(m); > + else > + print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu); > +#endif > + return 0; > +} > + > static void *move_iter(struct timer_list_iter *iter, loff_t offset) > { > for (; offset; offset--) { > @@ -376,3 +377,4 @@ static int __init init_timer_list_procfs(void) > return 0; > } > __initcall(init_timer_list_procfs); > +#endif > -- > 2.22.0.410.gd8fdbe21b5-goog > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To post to this group, send email to clang-built-linux@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190614181604.112297-1-nhuck%40google.com. > For more options, visit https://groups.google.com/d/optout. -- Thanks, ~Nick Desaulniers