From patchwork Tue Feb 23 08:25:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 8388921 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 D6F779F1D4 for ; Tue, 23 Feb 2016 08:29:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA3B220612 for ; Tue, 23 Feb 2016 08:29:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E49E20392 for ; Tue, 23 Feb 2016 08:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932759AbcBWI3u (ORCPT ); Tue, 23 Feb 2016 03:29:50 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37535 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932568AbcBWI3t (ORCPT ); Tue, 23 Feb 2016 03:29:49 -0500 Received: by mail-wm0-f49.google.com with SMTP id g62so198610987wme.0 for ; Tue, 23 Feb 2016 00:29:48 -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=qjnhw7CpYT6oEz467B524/4NqtX6s+dCW7WjyrHlIWA=; b=MuK6kLGOxuUSZ9M2THA9GzjclnEPer8Fkgrc9/06mXmWoEVlqvmBh3VkCmxclgjN0i ktW+T0rgs8GalNbQ85TyBeXLJO+eHIK19KYz1CtarFyy3yyvY6NH111DA72cA7nFcbWP 8pEyByUpGSCzJj/rJX+eNzgqGU7kkxg6K/9SqOOvrlNdXDPGSC6VYJwILMDfWh9tBimM ikbKgPQC7+sJ/fnHYe5Ow3EZtlFs2XmQo4QR7eQvGyCsAKHYVbDNsxBpSLqJ/SgCTt5x 9osGneTTXwjCXNCWyvDX8PcLCrMxqgDOraUAyKAa3W/x1wlc6RrQx9C/jhu6XkV5XamE iRZw== 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=qjnhw7CpYT6oEz467B524/4NqtX6s+dCW7WjyrHlIWA=; b=MnMG8GRqWsPSHTH0Ju9v89MlmNvXrrJYwfnB2sSSESyxNqw0uq+hmSzBjeh6f7iUZc dyNSdzBW1M+GmDaOzzp7sztdOmOBxZzyjBwGJT7eKJZsFcIiw37vWzINUp8X6AF3bKZW 55A6Avdvej6C1ZHL7frwIjppuTYfhoDIMW9wtnMRfIw1ysyc6JnZll91i8m58yQXn4Qq Xngy9kPOvPRr8EJWxiPC/IHOHUoBiOZd8yERSk9tgnA3VRm1litSZX+hzD7qRux2KkOY Xa3rjAtXmp5vp16zVmoX+fqYovOBNlFDW/tdE7LOI/60T2WPgYeZ/SQLv/Oe+8YwhlDY waFw== X-Gm-Message-State: AG10YOSSmTWggTKPOEwL/yKhDderw0twFXXBPwkIldRfddJl+nzQH2/dgnkSwYjZoMt2PA== X-Received: by 10.194.90.100 with SMTP id bv4mr32261578wjb.11.1456216188480; Tue, 23 Feb 2016 00:29:48 -0800 (PST) Received: from localhost ([213.57.247.249]) by smtp.gmail.com with ESMTPSA id k124sm24742722wmb.11.2016.02.23.00.29.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Feb 2016 00:29:47 -0800 (PST) From: Leon Romanovsky To: dledford@redhat.com, saeedm@mellanox.com Cc: linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH rdma-next V1 4/8] IB/core: Replace setting the zero values in ib_uverbs_ex_query_device Date: Tue, 23 Feb 2016 10:25:24 +0200 Message-Id: <1456215928-9305-5-git-send-email-leon@leon.nu> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456215928-9305-1-git-send-email-leon@leon.nu> References: <1456215928-9305-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 Reviewed-by: Matan Barak --- 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; }