mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: MD Danish Anwar <danishanwar@ti.com>
To: Dong Yibo <dong100@mucse.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <horms@kernel.org>, <corbet@lwn.net>,
	<gur.stavi@huawei.com>, <maddy@linux.ibm.com>,
	<mpe@ellerman.id.au>, <lee@trager.us>, <gongfan1@huawei.com>,
	<lorenzo@kernel.org>, <geert+renesas@glider.be>,
	<Parthiban.Veerasooran@microchip.com>, <lukas.bulwahn@redhat.com>,
	<alexanderduyck@fb.com>, <richardcochran@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 4/5] net: rnpgbe: Add basic mbx_fw support
Date: Wed, 13 Aug 2025 13:50:08 +0530	[thread overview]
Message-ID: <ab6e5c8c-6f91-4017-b68b-7fdf93980a17@ti.com> (raw)
In-Reply-To: <20250812093937.882045-5-dong100@mucse.com>



On 12/08/25 3:09 pm, Dong Yibo wrote:
> +/**
> + * mucse_fw_get_capability - Get hw abilities from fw
> + * @hw: pointer to the HW structure
> + * @abil: pointer to the hw_abilities structure
> + *
> + * mucse_fw_get_capability tries to get hw abilities from
> + * hw.
> + *
> + * @return: 0 on success, negative on failure
> + **/
> +static int mucse_fw_get_capability(struct mucse_hw *hw,
> +				   struct hw_abilities *abil)
> +{
> +	struct mbx_fw_cmd_reply reply;
> +	struct mbx_fw_cmd_req req;
> +	int err;
> +
> +	memset(&req, 0, sizeof(req));
> +	memset(&reply, 0, sizeof(reply));
> +	build_phy_abalities_req(&req, &req);

Typo in function name. You probably meant "build_phy_abilities_req".

> +	err = mucse_fw_send_cmd_wait(hw, &req, &reply);
> +	if (!err)
> +		memcpy(abil, &reply.hw_abilities, sizeof(*abil));
> +	return err;
> +}
> +
> +/**
> + * mucse_mbx_get_capability - Get hw abilities from fw
> + * @hw: pointer to the HW structure
> + *
> + * mucse_mbx_get_capability tries to some capabities from
> + * hw. Many retrys will do if it is failed.
> + *

Typo in comment: "tries to some capabities" should be "tries to get
capabilities"

> + * @return: 0 on success, negative on failure
> + **/
> +int mucse_mbx_get_capability(struct mucse_hw *hw)
> +{
> +	struct hw_abilities ability;
> +	int try_cnt = 3;
> +	int err;
> +
> +	memset(&ability, 0, sizeof(ability));
> +	while (try_cnt--) {
> +		err = mucse_fw_get_capability(hw, &ability);
> +		if (err)
> +			continue;
> +		hw->pfvfnum = le16_to_cpu(ability.pfnum);
> +		hw->fw_version = le32_to_cpu(ability.fw_version);
> +		hw->axi_mhz = le32_to_cpu(ability.axi_mhz);
> +		hw->bd_uid = le32_to_cpu(ability.bd_uid);
> +		return 0;
> +	}
> +	return err;
> +}


Missing initialization of err variable before the last return, which
could lead to undefined behavior if all attempts fail.

> +
> +/**
> + * mbx_cookie_zalloc - Alloc a cookie structure
> + * @priv_len: private length for this cookie
> + *


-- 
Thanks and Regards,
Danish


  parent reply	other threads:[~2025-08-13  8:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12  9:39 [PATCH v3 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-08-12  9:39 ` [PATCH v3 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-08-12 15:37   ` Vadim Fedorenko
2025-08-13  6:18     ` Yibo Dong
2025-08-12 16:18   ` Anwar, Md Danish
2025-08-13  6:44     ` Yibo Dong
2025-08-13  7:51       ` MD Danish Anwar
2025-08-13  8:00         ` Yibo Dong
2025-08-12  9:39 ` [PATCH v3 2/5] net: rnpgbe: Add n500/n210 chip support Dong Yibo
2025-08-12 15:49   ` Vadim Fedorenko
2025-08-13  7:01     ` Yibo Dong
2025-08-12 16:25   ` Anwar, Md Danish
2025-08-13  7:07     ` Yibo Dong
2025-08-12  9:39 ` [PATCH v3 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-08-12 16:07   ` Vadim Fedorenko
2025-08-12 16:30   ` Anwar, Md Danish
2025-08-13  7:46     ` Yibo Dong
2025-08-14 23:55   ` Andrew Lunn
2025-08-15  1:31     ` Yibo Dong
2025-08-15  4:07       ` Andrew Lunn
2025-08-12  9:39 ` [PATCH v3 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-08-12 16:14   ` Vadim Fedorenko
2025-08-13  8:12     ` Yibo Dong
2025-08-13  9:52     ` Yibo Dong
2025-08-13 11:05       ` Geert Uytterhoeven
2025-08-13 21:32         ` Jakub Kicinski
2025-08-13 13:33       ` Vadim Fedorenko
2025-08-14  1:53         ` Yibo Dong
2025-08-15  0:04       ` Andrew Lunn
2025-08-15  1:36         ` Yibo Dong
2025-08-13  8:20   ` MD Danish Anwar [this message]
2025-08-13  9:24     ` Yibo Dong
2025-08-12  9:39 ` [PATCH v3 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-08-12 15:32   ` Vadim Fedorenko
2025-08-13  9:04     ` Yibo Dong
2025-08-13 12:50       ` Vadim Fedorenko
2025-08-14  1:52         ` Yibo Dong
2025-08-13  8:26   ` MD Danish Anwar
2025-08-13  9:49     ` Yibo Dong

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=ab6e5c8c-6f91-4017-b68b-7fdf93980a17@ti.com \
    --to=danishanwar@ti.com \
    --cc=Parthiban.Veerasooran@microchip.com \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=gongfan1@huawei.com \
    --cc=gur.stavi@huawei.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee@trager.us \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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®