[v2] soc: qcom: llcc: Check return value on Broadcast_OR reg read

Message ID 20240210011415.3440236-1-quic_uchalich@quicinc.com
State New
Headers
Series [v2] soc: qcom: llcc: Check return value on Broadcast_OR reg read |

Commit Message

Unnathi Chalicheemala Feb. 10, 2024, 1:14 a.m. UTC
  Commit c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support")
introduced a new 4.1 if statement in llcc_update_act_ctrl() without
considering that ret might be overwritten. So, adding return value check
after Broadcast_OR register read in llcc_update_act_ctrl().

Fixes: c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support")

Signed-off-by: Unnathi Chalicheemala <quic_uchalich@quicinc.com>
Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>

---
Changes in v2:
- Referenced right commit to be fixed in the commit message.
- Added Elliot's R-B tag.
- Modified commit message to better explain problem statement.
- Link to v1: https://lore.kernel.org/all/20240202-fix_llcc_update_act_ctrl-v1-1-d36df95c8bd5@quicinc.com/

---
 drivers/soc/qcom/llcc-qcom.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Jeff Johnson Feb. 10, 2024, 1:30 a.m. UTC | #1
On 2/9/2024 5:14 PM, Unnathi Chalicheemala wrote:
> Commit c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support")
> introduced a new 4.1 if statement in llcc_update_act_ctrl() without
> considering that ret might be overwritten. So, adding return value check

nit: s/adding/add/ (use imperative voice)

> after Broadcast_OR register read in llcc_update_act_ctrl().
> 
> Fixes: c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support">

remove this blank line -- the Fixes tag should be grouped with the other
tags

> Signed-off-by: Unnathi Chalicheemala <quic_uchalich@quicinc.com>
> Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>
> 
> ---
> Changes in v2:
> - Referenced right commit to be fixed in the commit message.
> - Added Elliot's R-B tag.
> - Modified commit message to better explain problem statement.
> - Link to v1: https://lore.kernel.org/all/20240202-fix_llcc_update_act_ctrl-v1-1-d36df95c8bd5@quicinc.com/
> 
> ---
>  drivers/soc/qcom/llcc-qcom.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
> index 4ca88eaebf06..cbef0dea1d5d 100644
> --- a/drivers/soc/qcom/llcc-qcom.c
> +++ b/drivers/soc/qcom/llcc-qcom.c
> @@ -859,6 +859,8 @@ static int llcc_update_act_ctrl(u32 sid,
>  	ret = regmap_read_poll_timeout(drv_data->bcast_regmap, status_reg,
>  				      slice_status, !(slice_status & status),
>  				      0, LLCC_STATUS_READ_DELAY);
> +	if (ret)
> +		return ret;
>  
>  	if (drv_data->version >= LLCC_VERSION_4_1_0_0)
>  		ret = regmap_write(drv_data->bcast_regmap, act_clear_reg,
  
Unnathi Chalicheemala Feb. 12, 2024, 5:47 p.m. UTC | #2
On 2/9/2024 5:30 PM, Jeff Johnson wrote:
> On 2/9/2024 5:14 PM, Unnathi Chalicheemala wrote:
>> Commit c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support")
>> introduced a new 4.1 if statement in llcc_update_act_ctrl() without
>> considering that ret might be overwritten. So, adding return value check
> 
> nit: s/adding/add/ (use imperative voice)
> 

Ack.

>> after Broadcast_OR register read in llcc_update_act_ctrl().
>>
>> Fixes: c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support">
> 
> remove this blank line -- the Fixes tag should be grouped with the other
> tags
> 

Ack. I'll post v3 with these changes, thanks Jeff.

>> Signed-off-by: Unnathi Chalicheemala <quic_uchalich@quicinc.com>
>> Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>
  

Patch

diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
index 4ca88eaebf06..cbef0dea1d5d 100644
--- a/drivers/soc/qcom/llcc-qcom.c
+++ b/drivers/soc/qcom/llcc-qcom.c
@@ -859,6 +859,8 @@  static int llcc_update_act_ctrl(u32 sid,
 	ret = regmap_read_poll_timeout(drv_data->bcast_regmap, status_reg,
 				      slice_status, !(slice_status & status),
 				      0, LLCC_STATUS_READ_DELAY);
+	if (ret)
+		return ret;
 
 	if (drv_data->version >= LLCC_VERSION_4_1_0_0)
 		ret = regmap_write(drv_data->bcast_regmap, act_clear_reg,