From: Sudeep Holla Date: Thu, 13 Mar 2025 15:28:50 +0000 (+0000) Subject: mailbox: pcc: Return early if no GAS register from pcc_mbox_cmd_complete_check X-Git-Tag: block-6.15-20250403~21^2~5 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=4119a44c71840e6ab9a8d340ca09e7b3210ade76;p=linux-block.git mailbox: pcc: Return early if no GAS register from pcc_mbox_cmd_complete_check pcc_mbox_cmd_complete_check() accesses pchan->cmd_complete.gas to check command completion status. Even if GAS is NULL, pcc_chan_reg_read() gets called which returns success doing nothing and then we return. Add an early return if pchan->cmd_complete.gas == NULL before performing any operations. Acked-by: Huisong Li Tested-by: Huisong Li Tested-by: Adam Young Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar --- diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 9cf0ca772c1a..7105dd6bc2fc 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -245,13 +245,13 @@ static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan) u64 val; int ret; + if (!pchan->cmd_complete.gas) + return true; + ret = pcc_chan_reg_read(&pchan->cmd_complete, &val); if (ret) return false; - if (!pchan->cmd_complete.gas) - return true; - /* * Judge if the channel respond the interrupt based on the value of * command complete.