[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240429202237.6bbd2cb3@kernel.org>
Date: Mon, 29 Apr 2024 20:22:37 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Danielle Ratson <danieller@...dia.com>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<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: [PATCH net-next v5 09/10] ethtool: Add ability to flash
transceiver modules' firmware
On Wed, 24 Apr 2024 16:30:22 +0300 Danielle Ratson wrote:
> +static int
> +module_flash_fw_schedule(struct net_device *dev, const char *file_name,
> + struct ethtool_module_fw_flash_params *params,
> + struct netlink_ext_ack *extack)
> +{
> + struct ethtool_module_fw_flash *module_fw;
> + int err;
> +
> + err = __module_flash_fw_schedule(dev, extack);
> + if (err < 0)
> + return err;
Basic dev validation should probably be called directly from
ethnl_act_module_fw_flash() rather than two functions down.
> + module_fw = kzalloc(sizeof(*module_fw), GFP_KERNEL);
> + if (!module_fw)
> + return -ENOMEM;
> +
> + module_fw->params = *params;
> + err = request_firmware_direct(&module_fw->fw, file_name, &dev->dev);
> + if (err) {
> + NL_SET_ERR_MSG(extack,
> + "Failed to request module firmware image");
> + goto err_request_firmware;
Please name the labels after the actions they perform.
> + }
> +
> + err = module_flash_fw_work_init(module_fw, dev, extack);
> + if (err < 0) {
> + NL_SET_ERR_MSG(extack,
> + "Flashing module firmware is not supported by this device");
This overwrites the more accurate extack msg already set by
module_flash_fw_work_init()
> + goto err_work_init;
> + }
Powered by blists - more mailing lists