All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vadym Kochan <vadym.kochan@plvision.eu>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Taras Chornyi <tchornyi@marvell.com>,
	linux-kernel@vger.kernel.org,
	Mickey Rachamim <mickeyr@marvell.com>,
	Vadym Kochan <vkochan@marvell.com>
Subject: Re: [RFC net-next 1/4] net: marvell: prestera: try to load previous fw version
Date: Thu, 20 May 2021 03:12:02 +0200	[thread overview]
Message-ID: <YKW3YhuDSHQtR4Tb@lunn.ch> (raw)
In-Reply-To: <20210519143321.849-2-vadym.kochan@plvision.eu>

> +static int prestera_fw_get(struct prestera_fw *fw)
> +{
> +	int ver_maj = PRESTERA_SUPP_FW_MAJ_VER;
> +	int ver_min = PRESTERA_SUPP_FW_MIN_VER;
> +	char fw_path[128];
> +	int err;
> +
> +pick_fw_ver:
> +	snprintf(fw_path, sizeof(fw_path), PRESTERA_FW_PATH_FMT,
> +		 ver_maj, ver_min);
> +
> +	err = request_firmware_direct(&fw->bin, fw_path, fw->dev.dev);
> +	if (err) {
> +		if (ver_maj == PRESTERA_SUPP_FW_MAJ_VER) {
> +			ver_maj--;
> +			goto pick_fw_ver;
> +		} else {
> +			dev_err(fw->dev.dev, "failed to request firmware file\n");
> +			return err;
> +		}
> +	}

So lets say for the sake of the argument, you have version 3.0 and
2.42. It looks like this code will first try to load version 3.0. If
that fails, ver_maj is decremented, so it tries 2.0, which also fails
because it should be looking for 2.42. I don't think this decrement is
a good idea.

Also:

> +			dev_err(fw->dev.dev, "failed to request firmware file\n");

It would be useful to say what version you are actually looking for,
so the user can go find the correct firmware.

   Andrew

  reply	other threads:[~2021-05-20  1:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 14:33 [RFC net-next 0/4] Marvell Prestera Switchdev initial updates for firmware version 3.0 Vadym Kochan
2021-05-19 14:33 ` [RFC net-next 1/4] net: marvell: prestera: try to load previous fw version Vadym Kochan
2021-05-20  1:12   ` Andrew Lunn [this message]
2021-05-20 10:48     ` Vadym Kochan
2021-05-19 14:33 ` [RFC net-next 2/4] net: marvell: prestera: disable events interrupt while handling Vadym Kochan
2021-05-19 14:33 ` [RFC net-next 3/4] net: marvell: prestera: align flood setting according to latest firmware version Vadym Kochan
2021-05-19 14:33 ` [RFC net-next 4/4] net: marvell: prestera: bump supported firmware version to 3.0 Vadym Kochan

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=YKW3YhuDSHQtR4Tb@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mickeyr@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=tchornyi@marvell.com \
    --cc=vadym.kochan@plvision.eu \
    --cc=vkochan@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.