From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70F34C07E85 for ; Sun, 9 Dec 2018 15:01:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BAE020661 for ; Sun, 9 Dec 2018 15:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BAE020661 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726395AbeLIPBz (ORCPT ); Sun, 9 Dec 2018 10:01:55 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:46682 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbeLIPBy (ORCPT ); Sun, 9 Dec 2018 10:01:54 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gW0aU-00010T-Rr; Sun, 09 Dec 2018 15:01:42 +0000 From: Colin King To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Andrew Morton Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86/platform/olpc: remove duplicated check on node == -1 Date: Sun, 9 Dec 2018 15:01:42 +0000 Message-Id: <20181209150142.9010-1-colin.king@canonical.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently the node == -1 check is being performed twice, the second check is redundant and can be removed. Fix this by removing the redundant second check and moving the first check into a combined check with the result from the olpc_ofw call. Detected by cppcheck: Identical condition '(s32)node==-1', second condition is always false Signed-off-by: Colin Ian King --- arch/x86/platform/olpc/olpc_dt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c index b4ab779f1d47..658363ec3ff3 100644 --- a/arch/x86/platform/olpc/olpc_dt.c +++ b/arch/x86/platform/olpc/olpc_dt.c @@ -28,10 +28,7 @@ static phandle __init olpc_dt_getsibling(phandle node) const void *args[] = { (void *)node }; void *res[] = { &node }; - if ((s32)node == -1) - return 0; - - if (olpc_ofw("peer", args, res) || (s32)node == -1) + if (((s32)node == -1) || olpc_ofw("peer", args, res)) return 0; return node; -- 2.19.1