From patchwork Sun Dec 9 20:14:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Garrett Cooper X-Patchwork-Id: 1854571 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 478023FCF2 for ; Sun, 9 Dec 2012 20:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934477Ab2LIUOT (ORCPT ); Sun, 9 Dec 2012 15:14:19 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35567 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934474Ab2LIUOS (ORCPT ); Sun, 9 Dec 2012 15:14:18 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so1541872pad.19 for ; Sun, 09 Dec 2012 12:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:user-agent:mime-version :content-type; bh=DgxJpjXMhm7zqWWi58k55QzdJcZVtWcEuyBkxs89Ayc=; b=CUZyn53l6DbG8L5vWCpl2mdDAfDeEoh0TIEDkA1btY1NK5LkIYOIzXEnx0YlYauRRP pCERLBW/N1BcMpyRkSlzfpxXWCiRNRhiuPZ9Cu91TvjNAki2ivrvFY3Jv9mM3t9+nYfc h9jiKbLBQLozATwWsrwlgxaBVYJ6SWkakAZ/q7F/UWp0I4pWKXP0Ynmk/ZKEHcoP7XKK S5djAkPpQf5cogxwdMicfbKHecjC+qSYyKDa3pAhzk4TdjDLht6rnMIWm6K7nCj3dZsx tfIX7E9hEt6843Ph6dd835MYZCHjR6G1PwVgjYCIke/KmyxlZ+jHAaGJKZkEuzbeSvl7 /gmw== Received: by 10.68.134.130 with SMTP id pk2mr33170085pbb.31.1355084058310; Sun, 09 Dec 2012 12:14:18 -0800 (PST) Received: from c-24-19-191-56.hsd1.wa.comcast.net (c-24-19-191-56.hsd1.wa.comcast.net. [24.19.191.56]) by mx.google.com with ESMTPS id ty4sm10498678pbc.57.2012.12.09.12.14.17 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Dec 2012 12:14:17 -0800 (PST) Date: Sun, 9 Dec 2012 12:14:12 -0800 (PST) From: Garrett Cooper To: linux-rdma@vger.kernel.org Subject: [PATCH v2 1/3] Fix -Wtautological-compare warnings with clang Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From 1f91aeca2d9fecd1301d6fe2731a79d8640b2072 Mon Sep 17 00:00:00 2001 From: Garrett Cooper Date: Sun, 9 Dec 2012 02:44:32 -0800 Subject: [PATCH 1/3] Fix -Wtautological-compare warnings with clang V1: The noted branch conditions are true or false and hence not tested/executed as designed. Prune the always true/false conditional checks. V2: Fix the conditional check in osm_vendor_new by properly checking for IB_SUCCESS instead of assuming that values < 0 denotes error as this isn't possible given the enum definition. Signed-off-by: Garrett Cooper --- libvendor/osm_vendor_ibumad.c | 2 +- opensm/osm_qos_parser_y.y | 6 ++---- opensm/st.c | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c index ca320a6..63b9594 100644 --- a/libvendor/osm_vendor_ibumad.c +++ b/libvendor/osm_vendor_ibumad.c @@ -574,7 +574,7 @@ osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log, memset(p_vend, 0, sizeof(*p_vend)); - if (osm_vendor_init(p_vend, p_log, timeout) < 0) { + if (osm_vendor_init(p_vend, p_log, timeout) != IB_SUCCESS) { free(p_vend); p_vend = NULL; } diff --git a/opensm/osm_qos_parser_y.y b/opensm/osm_qos_parser_y.y index 4e01ed4..0b567c8 100644 --- a/opensm/osm_qos_parser_y.y +++ b/opensm/osm_qos_parser_y.y @@ -1648,8 +1648,7 @@ sl2vl_scope_from_list_of_ranges: list_of_ranges { num_pair = (uint64_t*)cl_list_obj(list_iterator); if (num_pair) { - if ( num_pair[0] < 0 || - num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH ) + if ( num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH ) { yyerror("port number out of range 'from' list"); free(num_pair); @@ -1680,8 +1679,7 @@ sl2vl_scope_to_list_of_ranges: list_of_ranges { num_pair = (uint64_t*)cl_list_obj(list_iterator); if (num_pair) { - if ( num_pair[0] < 0 || - num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH ) + if ( num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH ) { yyerror("port number out of range 'to' list"); free(num_pair); diff --git a/opensm/st.c b/opensm/st.c index 754648c..14db456 100644 --- a/opensm/st.c +++ b/opensm/st.c @@ -196,8 +196,6 @@ size_t size; #endif size = new_size(size); /* round up to prime number */ - if (size < 0) - return NULL; tbl = alloc(st_table); tbl->type = type;