Re: [PATCH] interconnect: qcom: Fix endianness in an intermediate storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 30 Sep 05:22 PDT 2021, Vladimir Zapolskiy wrote:

> A minor issue is reported by sparse:
> 
> bcm-voter.c:72:77: warning: restricted __le16 degrades to integer
> bcm-voter.c:76:78: warning: restricted __le16 degrades to integer
> bcm-voter.c:82:66: warning: incorrect type in argument 2 (different base types)
> bcm-voter.c:82:66:    expected unsigned int [usertype] base
> bcm-voter.c:82:66:    got restricted __le32 [usertype] unit
> bcm-voter.c:85:66: warning: incorrect type in argument 2 (different base types)
> bcm-voter.c:85:66:    expected unsigned int [usertype] base
> bcm-voter.c:85:66:    got restricted __le32 [usertype] unit
> 
> icc-rpmh.c:165:28: warning: incorrect type in assignment (different base types)
> icc-rpmh.c:165:28:    expected restricted __le32 [usertype] unit
> icc-rpmh.c:165:28:    got unsigned int [usertype]
> icc-rpmh.c:166:29: warning: incorrect type in assignment (different base types)
> icc-rpmh.c:166:29:    expected restricted __le16 [usertype] width
> icc-rpmh.c:166:29:    got unsigned short [usertype]
> 
> The change is intended to be non-functional, only the stored data of
> 'struct bcm_db' is changed and build time warnings from above are gone.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

Regards,
Bjorn

> Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@xxxxxxxxxx>
> ---
>  drivers/interconnect/qcom/bcm-voter.c | 8 ++++----
>  drivers/interconnect/qcom/icc-rpmh.c  | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
> index 8f385f9c2dd3..976938a84bd1 100644
> --- a/drivers/interconnect/qcom/bcm-voter.c
> +++ b/drivers/interconnect/qcom/bcm-voter.c
> @@ -69,20 +69,20 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
>  	for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) {
>  		for (i = 0; i < bcm->num_nodes; i++) {
>  			node = bcm->nodes[i];
> -			temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
> +			temp = bcm_div(node->sum_avg[bucket] * le16_to_cpu(bcm->aux_data.width),
>  				       node->buswidth * node->channels);
>  			agg_avg[bucket] = max(agg_avg[bucket], temp);
>  
> -			temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
> +			temp = bcm_div(node->max_peak[bucket] * le16_to_cpu(bcm->aux_data.width),
>  				       node->buswidth);
>  			agg_peak[bucket] = max(agg_peak[bucket], temp);
>  		}
>  
>  		temp = agg_avg[bucket] * bcm->vote_scale;
> -		bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
> +		bcm->vote_x[bucket] = bcm_div(temp, le32_to_cpu(bcm->aux_data.unit));
>  
>  		temp = agg_peak[bucket] * bcm->vote_scale;
> -		bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
> +		bcm->vote_y[bucket] = bcm_div(temp, le32_to_cpu(bcm->aux_data.unit));
>  	}
>  
>  	if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
> diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
> index 3eb7936d2cf6..e8533027ce38 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.c
> +++ b/drivers/interconnect/qcom/icc-rpmh.c
> @@ -162,8 +162,8 @@ int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev)
>  		return -EINVAL;
>  	}
>  
> -	bcm->aux_data.unit = le32_to_cpu(data->unit);
> -	bcm->aux_data.width = le16_to_cpu(data->width);
> +	bcm->aux_data.unit = data->unit;
> +	bcm->aux_data.width = data->width;
>  	bcm->aux_data.vcd = data->vcd;
>  	bcm->aux_data.reserved = data->reserved;
>  	INIT_LIST_HEAD(&bcm->list);
> -- 
> 2.33.0
> 



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux