From patchwork Sun Dec 9 11:05:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Garrett Cooper X-Patchwork-Id: 1853611 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C3CC2DF230 for ; Sun, 9 Dec 2012 11:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933844Ab2LILFQ (ORCPT ); Sun, 9 Dec 2012 06:05:16 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:63876 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933869Ab2LILFO (ORCPT ); Sun, 9 Dec 2012 06:05:14 -0500 Received: by mail-da0-f46.google.com with SMTP id p5so831196dak.19 for ; Sun, 09 Dec 2012 03:05:14 -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=sBkfNPClEC+kSno9Zx2LL88eikPMLHA4tBZsu2Dip5c=; b=J+kCPTwAg1t1zwUz9H+hrl8BNijronWQLX/Jg/OWsJknP3RlwAyVOkyQIImJKa5rqW e7U00Tu3T4fvm6UQA0Kl5kONx2X6ZGR/FM4RqtXY9QtKp8JlB2guCtj86y3DJsXTu7TB Tc3SUnCeVEVho3VImba1PK2b8qbk+g/MxHVmO5sLCwq2gNoFq/oPMc/PMb8Omxe3CxvB 0cpMn3cU7He92UkqUlyGBo8BRpyCdlA12J5/qSNZuEatyGot+xLToTYLutCFV8GMNIcl Bin+PvX64I11WbTXa9P0rKgoS5QvjvIU8GZsScj8yM2cd6vYQ96moXhTLfdSEexIT2L+ rDbA== Received: by 10.66.86.102 with SMTP id o6mr27306638paz.11.1355051114221; Sun, 09 Dec 2012 03:05:14 -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 ty4sm9923045pbc.57.2012.12.09.03.05.13 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Dec 2012 03:05:13 -0800 (PST) Date: Sun, 9 Dec 2012 03:05:08 -0800 (PST) From: Garrett Cooper To: linux-rdma@vger.kernel.org Subject: [PATCH 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 These branch conditions are always > 0 (or false) and hence not executed as designed. Also, enum by definition is always > 0, so the error condition isn't triggered ever. Signed-off-by: Garrett Cooper --- libvendor/osm_vendor_ibumad.c | 5 +---- opensm/osm_qos_parser_y.y | 6 ++---- opensm/st.c | 2 -- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c index ca320a6..cdb18e9 100644 --- a/libvendor/osm_vendor_ibumad.c +++ b/libvendor/osm_vendor_ibumad.c @@ -574,10 +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) { - free(p_vend); - p_vend = NULL; - } + osm_vendor_init(p_vend, p_log, timeout); Exit: OSM_LOG_EXIT(p_log); 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;