From patchwork Sat Feb 20 07:47:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 8365801 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 0704E9FC88 for ; Sat, 20 Feb 2016 07:48:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C29920511 for ; Sat, 20 Feb 2016 07:48:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DDDB2051C for ; Sat, 20 Feb 2016 07:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758124AbcBTHsm (ORCPT ); Sat, 20 Feb 2016 02:48:42 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35134 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758118AbcBTHsb (ORCPT ); Sat, 20 Feb 2016 02:48:31 -0500 Received: by mail-wm0-f49.google.com with SMTP id c200so105321268wme.0 for ; Fri, 19 Feb 2016 23:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leon-nu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6S5s/A54zpGE8sGR2sl84FMR7sNdYVF3ZRq+5ESp2hQ=; b=rk2hluKqqVVi3nHOAUcZexGnnvUsOE/IHH6xIoRDHbI83XoXJM1CfV6pK2SfEfgKcU qNDt9BgRdLcyjcKTKNB44puk/6D3hO5mrlxxYdPPGYl6MZcedgnp1BPh/yRUQ20mb9Nk 3EsduQ0x3NhvfbF9NQVpUVv38kTAxyoWBUNSC2QvoMfNrN11O50ric268NxHFsbmPX38 dmF3Qw+zc58Ra6dU6LvhXjet2XrxUkBUyNmfGp9g5fCKXtIZLBU+vDN6MY33djI6RmFN VbCmcadr4uZMbxYw+7R6gQHpSaaSjErFveM8sI+ALlZNcMTzH5Y0WdFnDYoTpLl0UW4y mXEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6S5s/A54zpGE8sGR2sl84FMR7sNdYVF3ZRq+5ESp2hQ=; b=JLiKcxFb3wxQgbC7+icvaylyHA/EFWfrKa2q60sWUE6/DN+wJ4dP+EIhVnAS8w1OtG 744RcXIBHUNAvFR4OOwy1KH9fpoS+sQ7x11MR9qa6Wb4G7lkyJ6o+Ctze0yykdH+P280 PTLfHQWclZWEdYKNXTNI9HMk++60jmH2Fwr3/J3V3k/Mq6hAp+O2mglMBEd15qzBWIh/ lv0ymEPUKu4AkSnVZGsLAectJGSGEg5a6S7CHyMYpYPFvF1iKIHCo4UxelEA2R20f5xF 5/RREg3yqdfNJS/UpvTUpVYbh47p3X+XjGWA64eo7PBS0y2yWKPv0p2mXv8bmSWEs1M4 WKtw== X-Gm-Message-State: AG10YOQYfjJerfH2Th4BqQ3a8GVaGl+4LdEYh1cIWfBzCdYvMCeOKwl0U2Fpd95c3wpTBw== X-Received: by 10.194.103.72 with SMTP id fu8mr18511589wjb.70.1455954510453; Fri, 19 Feb 2016 23:48:30 -0800 (PST) Received: from localhost ([213.57.247.249]) by smtp.gmail.com with ESMTPSA id e14sm10943610wmi.21.2016.02.19.23.48.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Feb 2016 23:48:29 -0800 (PST) From: Leon Romanovsky To: dledford@redhat.com, saeedm@mellanox.com Cc: linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH rdma-next 4/8] IB/core: Replace setting the zero values in ib_uverbs_ex_query_device Date: Sat, 20 Feb 2016 09:47:41 +0200 Message-Id: <1455954465-15141-5-git-send-email-leon@leon.nu> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455954465-15141-1-git-send-email-leon@leon.nu> References: <1455954465-15141-1-git-send-email-leon@leon.nu> 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Leon Romanovsky The setting to zero during variable initialization eliminates the need to explicitly set to zero variables and structures. Signed-off-by: Leon Romanovsky --- drivers/infiniband/core/uverbs_cmd.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 6ffc9c4..c647d67 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -3583,9 +3583,9 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, struct ib_udata *ucore, struct ib_udata *uhw) { - struct ib_uverbs_ex_query_device_resp resp; + struct ib_uverbs_ex_query_device_resp resp = { {0} }; struct ib_uverbs_ex_query_device cmd; - struct ib_device_attr attr; + struct ib_device_attr attr = {0}; int err; if (ucore->inlen < sizeof(cmd)) @@ -3606,14 +3606,11 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, if (ucore->outlen < resp.response_length) return -ENOSPC; - memset(&attr, 0, sizeof(attr)); - err = ib_dev->query_device(ib_dev, &attr, uhw); if (err) return err; copy_query_dev_fields(file, ib_dev, &resp.base, &attr); - resp.comp_mask = 0; if (ucore->outlen < resp.response_length + sizeof(resp.odp_caps)) goto end; @@ -3626,9 +3623,6 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, attr.odp_caps.per_transport_caps.uc_odp_caps; resp.odp_caps.per_transport_caps.ud_odp_caps = attr.odp_caps.per_transport_caps.ud_odp_caps; - resp.odp_caps.reserved = 0; -#else - memset(&resp.odp_caps, 0, sizeof(resp.odp_caps)); #endif resp.response_length += sizeof(resp.odp_caps); @@ -3646,8 +3640,5 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, end: err = ib_copy_to_udata(ucore, &resp, resp.response_length); - if (err) - return err; - - return 0; + return err; }