From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v1] iavf: Fix incorrect use of assigning iavf_status to int
Date: Tue, 25 Jan 2022 00:42:47 +0000 [thread overview]
Message-ID: <5332e7b8df740820a9b16af9bcee94e8d92ec4b4.camel@intel.com> (raw)
In-Reply-To: <20220121095512.20266-1-mateusz.palczewski@intel.com>
On Fri, 2022-01-21 at 10:55 +0100, Mateusz Palczewski wrote:
> @@ -65,55 +98,28 @@ int iavf_send_api_ver(struct iavf_adapter
> *adapter)
> ? **/
> ?int iavf_verify_api_ver(struct iavf_adapter *adapter)
> ?{
> -???????struct virtchnl_version_info *pf_vvi;
> -???????struct iavf_hw *hw = &adapter->hw;
> ????????struct iavf_arq_event_info event;
> -???????enum virtchnl_ops op;
> -???????enum iavf_status err;
> +???????int err;
> ?
> ????????event.buf_len = IAVF_MAX_AQ_BUF_SIZE;
> -???????event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);
> -???????if (!event.msg_buf) {
> -???????????????err = -ENOMEM;
> -???????????????goto out;
> -???????}
> -
> -???????while (1) {
> -???????????????err = iavf_clean_arq_element(hw, &event, NULL);
> -???????????????/* When the AQ is empty, iavf_clean_arq_element will
> return
> -??????????????? * nonzero and this loop will terminate.
> -??????????????? */
> -???????????????if (err)
> -???????????????????????goto out_alloc;
> -???????????????op =
> -?????????????????? (enum
> virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
> -???????????????if (op == VIRTCHNL_OP_VERSION)
> -???????????????????????break;
> -???????}
> +???????event.msg_buf = kzalloc(IAVF_MAX_AQ_BUF_SIZE, GFP_KERNEL);
> +???????if (!event.msg_buf)
> +???????????????return -ENOMEM;
> ?
> +???????err = iavf_poll_virtchnl_msg(&adapter->hw, &event,
> VIRTCHNL_OP_VERSION);
You're mixing error types. This error is propagated as iavf_status,
however, other failuers in this function are returning Linux error
codes.
The functions following this do this as well.
> +???????if (!err) {
> +???????????????struct virtchnl_version_info *pf_vvi =
> +???????????????????????(struct virtchnl_version_info
> *)event.msg_buf;
> +???????????????adapter->pf_version = *pf_vvi;
> ?
> -???????err = (enum iavf_status)le32_to_cpu(event.desc.cookie_low);
> -???????if (err)
> -???????????????goto out_alloc;
> -
> -???????if (op != VIRTCHNL_OP_VERSION) {
> -???????????????dev_info(&adapter->pdev->dev, "Invalid reply type %d
> from PF\n",
> -???????????????????????op);
> -???????????????err = -EIO;
> -???????????????goto out_alloc;
> +???????????????if (pf_vvi->major > VIRTCHNL_VERSION_MAJOR ||
> +?????????????????? (pf_vvi->major == VIRTCHNL_VERSION_MAJOR &&
> +??????????????????? pf_vvi->minor > VIRTCHNL_VERSION_MINOR))
> +???????????????????????err = -EIO;
> ????????}
> ?
> -???????pf_vvi = (struct virtchnl_version_info *)event.msg_buf;
> -???????adapter->pf_version = *pf_vvi;
> -
> -???????if ((pf_vvi->major > VIRTCHNL_VERSION_MAJOR) ||
> -?????????? ((pf_vvi->major == VIRTCHNL_VERSION_MAJOR) &&
> -??????????? (pf_vvi->minor > VIRTCHNL_VERSION_MINOR)))
> -???????????????err = -EIO;
> -
> -out_alloc:
> ????????kfree(event.msg_buf);
> -out:
> +
> ????????return err;
> ?}
next prev parent reply other threads:[~2022-01-25 0:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 9:55 [Intel-wired-lan] [PATCH net-next v1] iavf: Fix incorrect use of assigning iavf_status to int Mateusz Palczewski
2022-01-25 0:42 ` Nguyen, Anthony L [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-01-26 14:59 Mateusz Palczewski
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=5332e7b8df740820a9b16af9bcee94e8d92ec4b4.camel@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@osuosl.org \
/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