[RFC PATCH 3/7] firmware: arm_scmi: Add Telemetry protocol support

Dan Carpenter dan.carpenter at linaro.org
Fri Jun 20 14:01:23 PDT 2025


On Fri, Jun 20, 2025 at 08:28:09PM +0100, Cristian Marussi wrote:
> +	/* Build compsing DES string */
> +	for (int i = 0; i < ti->info.num_groups; i++) {
> +		struct scmi_telemetry_group *grp = &ti->info.des_groups[i];
> +		char *buf = grp->des_str;
> +		size_t bufsize = grp->des_str_sz;
> +
> +		for (int j = 0; j < grp->num_de; j++) {
> +			char term = j != (grp->num_de - 1) ? ' ' : '\0';
> +			int len;
> +
> +			len = snprintf(buf, bufsize, "0x%04X%c",
> +				       ti->info.des[grp->des[j]]->id, term);

Please use scnprintf() btw.  Otherwise if there is an overflow the
next iteration will complain that bufsize is negative.

> +
> +			buf += len;
> +			bufsize -= len;
> +		}
> +	}
> +
> +	return 0;
> +}

regards,
dan carpenter




More information about the linux-arm-kernel mailing list