mailbox: pcc: Reset pcc_chan_count to zero in case of PCC probe failure
authorHuisong Li <lihuisong@huawei.com>
Sat, 12 Nov 2022 02:05:28 +0000 (10:05 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 23 Nov 2022 18:06:56 +0000 (19:06 +0100)
Currently, 'pcc_chan_count' is remains set to a non-zero value if PCC
subspaces are parsed successfully but something else fail later during
the initial PCC probing phase. This will result in pcc_mbox_request_channel
trying to access the resources that are not initialised or allocated and
may end up in a system crash.

Reset pcc_chan_count to 0 when the PCC probe fails in order to prevent
the possible issue as described above.

Fixes: ce028702ddbc ("mailbox: pcc: Move bulk of PCCT parsing into pcc_mbox_probe")
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/mailbox/pcc.c

index 3c2bc0ca454cf1005193c45b85c28331c68b7f0a..105d46c9801bae236736b80fc195fd5f7710fb26 100644 (file)
@@ -743,6 +743,7 @@ static int __init pcc_init(void)
 
        if (IS_ERR(pcc_pdev)) {
                pr_debug("Err creating PCC platform bundle\n");
+               pcc_chan_count = 0;
                return PTR_ERR(pcc_pdev);
        }