From: Jason Gunthorpe <jgg@mellanox.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
Matan Barak <matanb@mellanox.com>,
Leon Romanovsky <leonro@mellanox.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mlx5: remove pointless memcpy
Date: Fri, 2 Feb 2018 12:06:00 -0700 [thread overview]
Message-ID: <20180202190600.GD9080@ziepe.ca> (raw)
In-Reply-To: <20180202154636.1624079-1-arnd@arndb.de>
On Fri, Feb 02, 2018 at 04:46:30PM +0100, Arnd Bergmann wrote:
> gcc-8 notices that the memcpy in mlx5_core_query_xsrq() makes no
> sense because the source and destination variables are identical:
>
> drivers/net/ethernet/mellanox/mlx5/core/transobj.c: In function 'mlx5_core_query_xsrq':
> drivers/net/ethernet/mellanox/mlx5/core/transobj.c:347:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict]
>
> Either one of the pointers should be something else, or the code is
> completely bogus. Removing the memcpy() won't change the behavior
> but gets rid of the warning.
>
> Fixes: 01949d0109ee ("net/mlx5_core: Enable XRCs and SRQs when using ISSI > 0")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Please review carefully, I have no idea what the author actually
> intended here.
I think they intended to adjust the command return between
mlx5_ifc_query_srq_out_bits and mlx5_ifc_query_xrc_srq_out_bits?
> index 9e38343a951f..75450f7d53bf 100644
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
> @@ -332,20 +332,12 @@ int mlx5_core_destroy_xsrq(struct mlx5_core_dev *dev, u32 xsrqn)
> int mlx5_core_query_xsrq(struct mlx5_core_dev *dev, u32 xsrqn, u32 *out)
> {
> u32 in[MLX5_ST_SZ_DW(query_xrc_srq_in)] = {0};
> - void *srqc;
> - void *xrc_srqc;
> int err;
>
> MLX5_SET(query_xrc_srq_in, in, opcode, MLX5_CMD_OP_QUERY_XRC_SRQ);
> MLX5_SET(query_xrc_srq_in, in, xrc_srqn, xsrqn);
> err = mlx5_cmd_exec(dev, in, sizeof(in), out,
> MLX5_ST_SZ_BYTES(query_xrc_srq_out));
> - if (!err) {
> - xrc_srqc = MLX5_ADDR_OF(query_xrc_srq_out, out,
> - xrc_srq_context_entry);
> - srqc = MLX5_ADDR_OF(query_srq_out, out, srq_context_entry);
> - memcpy(srqc, xrc_srqc, MLX5_ST_SZ_BYTES(srqc));
> - }
Probably should add a
BUILD_BUG_ON(MLX5_BYTE_OFF(query_xrc_srq_out, xrc_srq_context_entry) == MLX5_BYTE_OFF(query_srq_out, srq_context_entry));
Just for clarity that the SRQ and XRC_SRQ are being used interchangeably.
and the 'err' variable can be eliminated.
Curious though that I can't find a call site for it, and removing the
prototype doesn't break the build.. Seems like dead code.
Jason
next prev parent reply other threads:[~2018-02-02 19:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 15:46 Arnd Bergmann
2018-02-02 19:06 ` Jason Gunthorpe [this message]
2018-02-02 20:26 ` Arnd Bergmann
2018-02-03 4:38 ` Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180202190600.GD9080@ziepe.ca \
--to=jgg@mellanox.com \
--cc=arnd@arndb.de \
--cc=leonro@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=saeedm@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®