From patchwork Mon May 11 12:13:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Marciniszyn, Mike" X-Patchwork-Id: 6376321 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 922079F32E for ; Mon, 11 May 2015 12:13:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C431C2027D for ; Mon, 11 May 2015 12:13:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDACB20279 for ; Mon, 11 May 2015 12:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbbEKMNl (ORCPT ); Mon, 11 May 2015 08:13:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:4555 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751614AbbEKMNl (ORCPT ); Mon, 11 May 2015 08:13:41 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 11 May 2015 05:13:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,406,1427785200"; d="scan'208";a="708333971" Received: from sedona.ch.intel.com ([143.182.228.65]) by fmsmga001.fm.intel.com with ESMTP; 11 May 2015 05:13:16 -0700 Received: from phlsvsles11.ph.intel.com (phlsvsles11.ph.intel.com [10.228.195.43]) by sedona.ch.intel.com (8.13.6/8.14.3/Standard MailSET/Hub) with ESMTP id t4BCDFDQ028800; Mon, 11 May 2015 05:13:16 -0700 Received: from phlsvslse11.ph.intel.com (localhost [127.0.0.1]) by phlsvsles11.ph.intel.com with ESMTP id t4BCDFrW021066; Mon, 11 May 2015 08:13:15 -0400 Subject: [PATCH] IB/qib: fix test of unsigned variable To: roland@purestorage.com From: Mike Marciniszyn Cc: linux-rdma@vger.kernel.org, Doug Ledford Date: Mon, 11 May 2015 08:13:15 -0400 Message-ID: <20150511121315.21044.78464.stgit@phlsvslse11.ph.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Commit d4988623cc60 ("IB/qib: use arch_phys_wc_add()") adjusted mtrr inititialization to use the new interface. Unfortunately, the new interface returns a signed value and the patch tested the unsigned wc_cookie. Fix the issue by using 'ret' and only assigning wc_cookie from ret when ret >= 0. Additionally, insure ret is 0 on success. Signed-off-by: Mike Marciniszyn --- drivers/infiniband/hw/qib/qib_wc_x86_64.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/qib/qib_wc_x86_64.c b/drivers/infiniband/hw/qib/qib_wc_x86_64.c index 6d61ef9..85525be 100644 --- a/drivers/infiniband/hw/qib/qib_wc_x86_64.c +++ b/drivers/infiniband/hw/qib/qib_wc_x86_64.c @@ -116,9 +116,11 @@ int qib_enable_wc(struct qib_devdata *dd) } if (!ret) { - dd->wc_cookie = arch_phys_wc_add(pioaddr, piolen); - if (dd->wc_cookie < 0) - ret = -EINVAL; + ret = arch_phys_wc_add(pioaddr, piolen); + if (ret >= 0) { + dd->wc_cookie = ret; + ret = 0; + } } return ret;