Skip to content

Commit a5b45b7

Browse files
dcuibjorn-helgaas
authored andcommitted
PCI: hv: Handle hv_pci_generic_compl() error case
'completion_status' is used in some places, e.g., hv_pci_protocol_negotiation(), so we should make sure it's initialized in error case too, though the error is unlikely here. [bhelgaas: fix changelog typo and nearby whitespace] Signed-off-by: Dexuan Cui <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: KY Srinivasan <[email protected]> CC: Jake Oshins <[email protected]> CC: Haiyang Zhang <[email protected]> CC: Vitaly Kuznetsov <[email protected]>
1 parent 665e224 commit a5b45b7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/pci/host/pci-hyperv.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,15 +447,16 @@ struct hv_pci_compl {
447447
* for any message for which the completion packet contains a
448448
* status and nothing else.
449449
*/
450-
static
451-
void
452-
hv_pci_generic_compl(void *context, struct pci_response *resp,
453-
int resp_packet_size)
450+
static void hv_pci_generic_compl(void *context, struct pci_response *resp,
451+
int resp_packet_size)
454452
{
455453
struct hv_pci_compl *comp_pkt = context;
456454

457455
if (resp_packet_size >= offsetofend(struct pci_response, status))
458456
comp_pkt->completion_status = resp->status;
457+
else
458+
comp_pkt->completion_status = -1;
459+
459460
complete(&comp_pkt->host_event);
460461
}
461462

0 commit comments

Comments
 (0)