From patchwork Thu Sep 27 01:10:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10617087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 932E7417B for ; Thu, 27 Sep 2018 01:10:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 804BF2B3F4 for ; Thu, 27 Sep 2018 01:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 724D92B41C; Thu, 27 Sep 2018 01:10:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EE9E2B3F4 for ; Thu, 27 Sep 2018 01:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbeI0HZ5 (ORCPT ); Thu, 27 Sep 2018 03:25:57 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55945 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726549AbeI0HZ4 (ORCPT ); Thu, 27 Sep 2018 03:25:56 -0400 Received: by mail-wm1-f67.google.com with SMTP id 206-v6so4081377wmb.5 for ; Wed, 26 Sep 2018 18:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fhql9BC5TKjOJlXLefkE95zy0IXNXQ75/gZOEb0eZoE=; b=cyBlgPcq39HD9xksJCUlQAw7iccjUHNJB3fjvUzKFIj6BFLZwEoxGcDoQvDGlXdRJj fBYB0g0e/r3kxBNNWg8trxghCxh2Heq/zjkJFTgyuUpVMcwArou4nbLioPAyck95WYw+ A1EyNkTZNneoFgGXBdqcbdu/mz40RrHndon2yOMPelrhuG5MOtJ4HL4OAvDdVf3C4tOh aejY/UyLq+cHWOlV8ZW/M4WcYIKMmeZjk17V6wAulgL3mYNfyO7QUTmtpoYF1Ldk8F57 OhQ6CjxcZIKuohsR8ZCnAzaNH3eJeIpYBz326dDpxNBt9Z0ZVgL4o9CevxNVYiDIMzHt BPRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fhql9BC5TKjOJlXLefkE95zy0IXNXQ75/gZOEb0eZoE=; b=ZlxHEiliDbvmM+O0kS0bbFlsd1xLPy9its9WuUCIyadzSjglff+4DhRHCheXsBKKrU P9B8mds8SHnnD8mDuUoeGfnKAc42/3wxwbTJ1YYWPWEhZ3KNyhIoSw3UIMy88q3l54Tj w1in89Tkhrf3x0ppqIb9y0D5mVhR0pP/QYaT2iFb8EEmj6JmxT94P5jylLuThPfCUQIe 5KCD6Ev0xY60TS2w4I0ScC6rTvf2J3+hI8PRRLStfAYPEdwjlwBWBrRq9BgkAS70+Iac 6BSa9s0ykI665KKCJu0hD/76J3eG9D4hqNMmBm5RVdZ/ujDNqQ6vucMpLdy8YAuGLA8W kUwA== X-Gm-Message-State: ABuFfoi2dwRne+Gq/Kbhot1pTlKjsea84Ko+INFNFHOf7dvrd2RTU4Kc PqgpyLPw5ejLOisXRn93/Kc= X-Google-Smtp-Source: ACcGV60OFyUOF4Hcv8ozzyxsWh5rArV2x/jIjBRWXu+SgRE8cT7lRh/1Oa2sj6t7Uk36r76K1vfbHQ== X-Received: by 2002:a1c:838a:: with SMTP id f132-v6mr5918085wmd.127.1538010615286; Wed, 26 Sep 2018 18:10:15 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id x186-v6sm321385wmx.24.2018.09.26.18.10.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 18:10:14 -0700 (PDT) From: Nathan Chancellor To: Moni Shoua , Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, Nick Desaulniers , Nathan Chancellor Subject: [PATCH] IB/rxe: Add explicit enum conversions in rxe_init functions Date: Wed, 26 Sep 2018 18:10:10 -0700 Message-Id: <20180927011010.8373-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clang warns when an emumerated type is implicitly converted to another. drivers/infiniband/sw/rxe/rxe.c:106:27: warning: implicit conversion from enumeration type 'enum rxe_device_param' to different enumeration type 'enum ib_atomic_cap' [-Wenum-conversion] rxe->attr.atomic_cap = RXE_ATOMIC_CAP; ~ ^~~~~~~~~~~~~~ drivers/infiniband/sw/rxe/rxe.c:131:22: warning: implicit conversion from enumeration type 'enum rxe_port_param' to different enumeration type 'enum ib_port_state' [-Wenum-conversion] port->attr.state = RXE_PORT_STATE; ~ ^~~~~~~~~~~~~~ drivers/infiniband/sw/rxe/rxe.c:132:24: warning: implicit conversion from enumeration type 'enum rxe_port_param' to different enumeration type 'enum ib_mtu' [-Wenum-conversion] port->attr.max_mtu = RXE_PORT_MAX_MTU; ~ ^~~~~~~~~~~~~~~~ drivers/infiniband/sw/rxe/rxe.c:133:27: warning: implicit conversion from enumeration type 'enum rxe_port_param' to different enumeration type 'enum ib_mtu' [-Wenum-conversion] port->attr.active_mtu = RXE_PORT_ACTIVE_MTU; ~ ^~~~~~~~~~~~~~~~~~~ drivers/infiniband/sw/rxe/rxe.c:151:24: warning: implicit conversion from enumeration type 'enum rxe_port_param' to different enumeration type 'enum ib_mtu' [-Wenum-conversion] ib_mtu_enum_to_int(RXE_PORT_ACTIVE_MTU); ~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~ 5 warnings generated. Mark all of these conversions as explicit to make it clear that this is expected behavior. All of these values are mapped to a value from the expected type. Reported-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- drivers/infiniband/sw/rxe/rxe.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c index 10999fa69281..cac5e038449b 100644 --- a/drivers/infiniband/sw/rxe/rxe.c +++ b/drivers/infiniband/sw/rxe/rxe.c @@ -103,7 +103,8 @@ static void rxe_init_device_param(struct rxe_dev *rxe) rxe->attr.max_res_rd_atom = RXE_MAX_RES_RD_ATOM; rxe->attr.max_qp_init_rd_atom = RXE_MAX_QP_INIT_RD_ATOM; rxe->attr.max_ee_init_rd_atom = RXE_MAX_EE_INIT_RD_ATOM; - rxe->attr.atomic_cap = RXE_ATOMIC_CAP; + rxe->attr.atomic_cap = + (enum ib_atomic_cap)RXE_ATOMIC_CAP; rxe->attr.max_ee = RXE_MAX_EE; rxe->attr.max_rdd = RXE_MAX_RDD; rxe->attr.max_mw = RXE_MAX_MW; @@ -128,9 +129,9 @@ static void rxe_init_device_param(struct rxe_dev *rxe) /* initialize port attributes */ static int rxe_init_port_param(struct rxe_port *port) { - port->attr.state = RXE_PORT_STATE; - port->attr.max_mtu = RXE_PORT_MAX_MTU; - port->attr.active_mtu = RXE_PORT_ACTIVE_MTU; + port->attr.state = (enum ib_port_state)RXE_PORT_STATE; + port->attr.max_mtu = (enum ib_mtu)RXE_PORT_MAX_MTU; + port->attr.active_mtu = (enum ib_mtu)RXE_PORT_ACTIVE_MTU; port->attr.gid_tbl_len = RXE_PORT_GID_TBL_LEN; port->attr.port_cap_flags = RXE_PORT_PORT_CAP_FLAGS; port->attr.max_msg_sz = RXE_PORT_MAX_MSG_SZ; @@ -148,7 +149,7 @@ static int rxe_init_port_param(struct rxe_port *port) port->attr.active_speed = RXE_PORT_ACTIVE_SPEED; port->attr.phys_state = RXE_PORT_PHYS_STATE; port->mtu_cap = - ib_mtu_enum_to_int(RXE_PORT_ACTIVE_MTU); + ib_mtu_enum_to_int((enum ib_mtu)RXE_PORT_ACTIVE_MTU); port->subnet_prefix = cpu_to_be64(RXE_PORT_SUBNET_PREFIX); return 0;