From 90bc10978da1d22c3ee2326484c04d8643685900 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Thu, 23 Apr 2020 13:57:41 -0700 Subject: [PATCH] haven: dbl: Initialize cap ids to HH_CAPID_INVAL Currently, the cap-ids for doorbells are initialized to 0. However, 0 is a valid value for cap-id. Instead, initialize cap-ids to HH_CAPID_INVAL in the doorbell driver. Change-Id: Ia1588ed372f0657444e1ab39eab9e6c1e6d3d156 Signed-off-by: Elliot Berman --- drivers/virt/haven/hh_dbl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/virt/haven/hh_dbl.c b/drivers/virt/haven/hh_dbl.c index 945a09e8973e..d87f13da032d 100644 --- a/drivers/virt/haven/hh_dbl.c +++ b/drivers/virt/haven/hh_dbl.c @@ -67,7 +67,7 @@ static int hh_dbl_validate_params(struct hh_dbl_desc *client_desc, * There are no doorbell setup for Tx or Rx */ if (dir == HH_DBL_DIRECTION_RX) { - if (!cap_table_entry->rx_cap_id || + if ((cap_table_entry->rx_cap_id == HH_CAPID_INVAL) || !cap_table_entry->rx_reg_done) { pr_err("%s: label: %d; rx_cap_id: %llu; dir: %d rx_done: %d\n", __func__, client_desc->label, @@ -76,7 +76,7 @@ static int hh_dbl_validate_params(struct hh_dbl_desc *client_desc, return -EAGAIN; } } else { - if (!cap_table_entry->tx_cap_id || + if ((cap_table_entry->tx_cap_id == HH_CAPID_INVAL) || !cap_table_entry->tx_reg_done) { pr_err("%s: label: %d; tx_cap_id: %llu; dir: %d tx_done: %d\n", __func__, client_desc->label, @@ -575,6 +575,8 @@ static int __init hh_dbl_init(void) for (i = 0; i < HH_DBL_LABEL_MAX; i++) { entry = &hh_dbl_cap_table[i]; mutex_init(&entry->cap_entry_lock); + entry->tx_cap_id = HH_CAPID_INVAL; + entry->rx_cap_id = HH_CAPID_INVAL; entry->rx_irq_name = kasprintf(GFP_KERNEL, "hh_dbl_rx_%d", i); if (!entry->rx_irq_name) { ret = -ENOMEM;