From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jork Loeser <jloeser@microsoft.com>
Cc: helgaas@kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com,
jasowang@redhat.com, leann.ogasawara@canonical.com,
marcelo.cerri@canonical.com, sthemmin@microsoft.com
Subject: Re: [PATCH 3/4] Hyper-V vPCI: Add vPCI version protocol negotiation
Date: Fri, 19 May 2017 14:20:00 +0300 [thread overview]
Message-ID: <20170519112000.4vsmlc545mgbndqf@mwanda> (raw)
In-Reply-To: <1495134870-18225-4-git-send-email-jloeser@linuxonhyperv.com>
On Thu, May 18, 2017 at 12:14:29PM -0700, Jork Loeser wrote:
> static int hv_pci_protocol_negotiation(struct hv_device *hdev)
> {
> + size_t i;
Could you just use "int i". I know some static checkers complain but
those tools are dumb. I just fixed a couple bugs two days ago where
people were like, "If i is declared as a u32 that means it's safe" and
it turns out, nope. No need to get fancy.
And could you put the i at the end of the declaration block in reverse
Christmas tree order? It matches the others in this function.
loooooooooooooooooooooooooooong var;
meeeeeeedium var;
int ret;
int i;
> struct pci_version_request *version_req;
> struct hv_pci_compl comp_pkt;
> struct pci_packet *pkt;
> @@ -1816,28 +1832,44 @@ static int hv_pci_protocol_negotiation(struct hv_device *hdev)
> pkt->compl_ctxt = &comp_pkt;
> version_req = (struct pci_version_request *)&pkt->message;
> version_req->message_type.type = PCI_QUERY_PROTOCOL_VERSION;
> - version_req->protocol_version = PCI_PROTOCOL_VERSION_CURRENT;
>
> - ret = vmbus_sendpacket(hdev->channel, version_req,
> - sizeof(struct pci_version_request),
> - (unsigned long)pkt, VM_PKT_DATA_INBAND,
> - VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
> - if (ret)
> - goto exit;
> + for (i = 0; i < ARRAY_SIZE(pci_protocol_versions); i++) {
> + version_req->protocol_version = pci_protocol_versions[i];
> + ret = vmbus_sendpacket(
> + hdev->channel, version_req,
> + sizeof(struct pci_version_request),
> + (unsigned long)pkt, VM_PKT_DATA_INBAND,
> + VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
The indenting is messed up because VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED
is really long. http://new_words.enacademic.com/2023/noun-banging
NOUN_NOUN_NOUN_NOUN_NOUN_ADJECTIVE. I guess do this:
ret = vmbus_sendpacket(hdev->channel, version_req,
sizeof(*version_req), (unsigned long)pkt,
VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
> + if (ret)
> + goto exit;
This "goto exit;" prints a successful message, but it's a failure path.
We also print a message on every iteration through this function. Since
we only go through the function once in the current code it's works but
let's fix it.
regards,
dan carpenter
next prev parent reply other threads:[~2017-05-19 11:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 19:14 Hyper-V vPCI: Use current vPCI protocol Jork Loeser
2017-05-18 19:14 ` [PATCH 1/4] Hyper-V vPCI: Minor format and semantic fix Jork Loeser
2017-05-18 19:14 ` [PATCH 2/4] Hyper-V vPCI: Use page allocation for hbus structure Jork Loeser
2017-05-18 19:14 ` [PATCH 3/4] Hyper-V vPCI: Add vPCI version protocol negotiation Jork Loeser
2017-05-19 11:20 ` Dan Carpenter [this message]
2017-05-18 19:14 ` [PATCH 4/4] Hyper-V vPCI: use vPCI protocol version 1.2 Jork Loeser
2017-05-18 23:58 ` Stephen Hemminger
2017-05-19 2:13 ` Jork Loeser
2017-05-19 10:03 ` Vitaly Kuznetsov
2017-05-19 13:48 ` KY Srinivasan
2017-05-19 9:59 ` Vitaly Kuznetsov
2017-05-24 14:58 ` Jork Loeser
2017-05-19 11:27 ` Dan Carpenter
2017-05-19 15:21 ` Stephen Hemminger
2017-05-24 15:07 ` Jork Loeser
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=20170519112000.4vsmlc545mgbndqf@mwanda \
--to=dan.carpenter@oracle.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=helgaas@kernel.org \
--cc=jasowang@redhat.com \
--cc=jloeser@microsoft.com \
--cc=leann.ogasawara@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=marcelo.cerri@canonical.com \
--cc=olaf@aepfle.de \
--cc=sthemmin@microsoft.com \
--cc=vkuznets@redhat.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;
as well as URLs for NNTP newsgroup(s).