[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240122103759.GB126470@kernel.org>
Date: Mon, 22 Jan 2024 10:37:59 +0000
From: Simon Horman <horms@...nel.org>
To: Danielle Ratson <danieller@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, corbet@....net,
linux@...linux.org.uk, sdf@...gle.com, kory.maincent@...tlin.com,
maxime.chevallier@...tlin.com, vladimir.oltean@....com,
przemyslaw.kitszel@...el.com, ahmed.zaki@...el.com,
richardcochran@...il.com, shayagr@...zon.com,
paul.greenwalt@...el.com, jiri@...nulli.us,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
mlxsw@...dia.com, petrm@...dia.com, idosch@...dia.com
Subject: Re: [RFC PATCH net-next 9/9] ethtool: Add ability to flash
transceiver modules' firmware
On Mon, Jan 22, 2024 at 10:45:30AM +0200, Danielle Ratson wrote:
..
> +static int module_flash_fw(struct net_device *dev, struct nlattr **tb,
> + struct netlink_ext_ack *extack)
> +{
> + struct ethtool_module_fw_flash_params params = {};
> + struct nlattr *attr;
> +
> + if (!tb[ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME]) {
> + NL_SET_ERR_MSG_ATTR(extack,
> + tb[ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME],
> + "File name attribute is missing");
> + return -EINVAL;
> + }
> +
> + params.file_name =
> + nla_data(tb[ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME]);
> +
> + attr = tb[ETHTOOL_A_MODULE_FW_FLASH_PASSWORD];
> + if (attr) {
> + params.password = cpu_to_be32(nla_get_u32(attr));
Hi Danielle,
The type of password is u32, so perhaps cpu_to_be32() isn't needed here?
Flagged by Sparse.
> + params.password_valid = true;
> + }
> +
> + return module_flash_fw_schedule(dev, ¶ms, extack);
> +}
..
Powered by blists - more mailing lists