From patchwork Tue Jul 7 19:54:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 6738951 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5FAF9C05AC for ; Tue, 7 Jul 2015 19:55:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86FBE20691 for ; Tue, 7 Jul 2015 19:55:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EFC720689 for ; Tue, 7 Jul 2015 19:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933499AbbGGTzY (ORCPT ); Tue, 7 Jul 2015 15:55:24 -0400 Received: from mout.web.de ([212.227.15.3]:58794 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933461AbbGGTyr (ORCPT ); Tue, 7 Jul 2015 15:54:47 -0400 Received: from [192.168.1.2] ([78.48.70.40]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MKwFs-1ZCYx03H7Y-00028h; Tue, 07 Jul 2015 21:54:42 +0200 Subject: [PATCH v3] kconfig: Delete unnecessary checks before the function call "sym_calc_value" To: "Yann E. MORIN" , linux-kbuild@vger.kernel.org References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <54568924.5010008@users.sourceforge.net> <5457CC33.4050906@users.sourceforge.net> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall , Paul Bolle From: SF Markus Elfring Message-ID: <559C2E7A.1090408@users.sourceforge.net> Date: Tue, 7 Jul 2015 21:54:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <5457CC33.4050906@users.sourceforge.net> X-Provags-ID: V03:K0:mKx/Oty2TZ3bueeFk2f7G+zkw9xSYb/5OeHwC70xe6eBhT/Nxtt IrDLuYRKzG2jmYKIJS/vDFBpc+gt4/4RfIcE+QX2KomzKw+Hp83fBnL+EGD8U7YArjjZLuW yOy+g3hXrMtPefYZ645QEZKR9YkMzhmepZSM2esvV31esn52e7QXtdZIPXoTaiJxrhn/iyj n6G4OfVn/c7mPjbjBbm1g== X-UI-Out-Filterresults: notjunk:1; V01:K0:f4AuWRsbzls=:1Qb7lvacFvvWumhoNyGz4z fSoR+e/g11DzTqWqaFnYVJ/C1D7cKJuWqMOTqVL/HrhFb8GP2I6eBjQhyfp7pHCuckbglnTsS BxuRpEGnuGnJXOxi4ZkrWpOpJNvYKr8Tvzri4R1kMVeO5aOzOvM2HGoRlX7Rs0V9GoeVdBgVZ nvmGTCXDRoQ7s+/O4guoFcpk0I2kHJUYV9GNqR+/O2QMrVwkgw4iYcVuKU+ufzAnT4qTOZJ3u BGYev3X7PRI1+3XT172BNXBDYMwIHYV22XZWWNEAztb/MyvsmgwGXnEFjnoCmCxmczgA71SNa msQWjNw2ZAGeYEpKi2ud2LqGfjG8zBlQWfIr5BQ7G30NfGlHB2ldzaAI5s6GYgx3IFBPJByUJ gVGy7v5b7VGQYp/xIV13xZfNZZH7/v9i2i2n7pcQrmLrwNVDG9rqfmi1f3YPQ6okfp+dXS1+W HbsvW3TqWg03gO80vGtT/zKadBuYTxNfMa/JZC466FMi3OwKnrLy4DfYXJCqDYOmDk5Z3NJPB j/uJrAT5p+TtReQDU3GswPHSIHwq8SnQzB+mf2R7uakiqyRfjdRJysTIHg5n0E2s17qRwQK0L zUS8UXWLUwuWO3oWkaaIVNll+qIB65wZHCl2aE1p2PSWLKyFlKKo8er8TOlZl6VTUREoMhbjb GNIb8Go5fuuzLTIofnrmQTlAw6+bcHrFfuRrswV11yNy4inlm4RWkSepMi2sbKQh4Msg= Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 7 Jul 2015 21:48:23 +0200 The sym_calc_value() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- scripts/kconfig/confdata.c | 7 ++----- scripts/kconfig/symbol.c | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index c814f57..0b7dc2f 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -268,8 +268,7 @@ int conf_read_simple(const char *name, int def) goto load; sym_add_change_count(1); if (!sym_defconfig_list) { - if (modules_sym) - sym_calc_value(modules_sym); + sym_calc_value(modules_sym); return 1; } @@ -404,9 +403,7 @@ setsym: } free(line); fclose(in); - - if (modules_sym) - sym_calc_value(modules_sym); + sym_calc_value(modules_sym); return 0; } diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 70c5ee1..50878dc 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -467,8 +467,7 @@ void sym_clear_all_valid(void) for_all_symbols(i, sym) sym->flags &= ~SYMBOL_VALID; sym_add_change_count(1); - if (modules_sym) - sym_calc_value(modules_sym); + sym_calc_value(modules_sym); } bool sym_tristate_within_range(struct symbol *sym, tristate val)