From 603c54fda3ea19105d4ed54b66700fb621470fa7 Mon Sep 17 00:00:00 2001 From: Lina Iyer Date: Tue, 18 Aug 2020 13:44:42 -0600 Subject: [PATCH] drivers: qcom: rpmh-rsc: check for control TCS availablilty Write the PDC data only if the RSC allow writing to the control TCS. Change-Id: I7795773075a563c939f41dc8f389d618120ec7e0 Signed-off-by: Lina Iyer --- drivers/soc/qcom/rpmh-rsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 0481b00dcb3a..1a3a19eab131 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -642,9 +642,11 @@ int rpmh_rsc_write_pdc_data(struct rsc_drv *drv, const struct tcs_request *msg) { int i; void __iomem *addr = drv->base + RSC_PDC_DRV_DATA; + struct tcs_group *tcs = get_tcs_of_type(drv, CONTROL_TCS); struct tcs_cmd *cmd; - if (!msg || !msg->cmds || msg->num_cmds != RSC_PDC_DATA_SIZE) + if (!msg || !msg->cmds || msg->num_cmds != RSC_PDC_DATA_SIZE || + !tcs->num_tcs) return -EINVAL; for (i = 0; i < msg->num_cmds; i++) {