Thread (7 messages) 7 messages, 2 authors, 2020-07-09

RE: [PATCH 1/2] firmware: arm_scmi: Keep the discrete clock rates sorted

From: Dien Pham <hidden>
Date: 2020-07-09 08:53:51
Also in: linux-clk, lkml

Dear Sudeep-san,
quoted
quoted
+}
+
static int
scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
			      struct scmi_clock_info *clk) @@ -184,8 +193,10 @@ 
scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
		 */
	} while (num_returned && num_remaining);

-	if (rate_discrete)
+	if (rate_discrete) {
		clk->list.num_rates = tot_rate_cnt;
+		sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
About warning of above line, I think it relates to below snip of code:
                if (tot_rate_cnt + num_returned > SCMI_MAX_NUM_RATES) {
                        dev_err(handle->dev, "No. of rates > MAX_NUM_RATES");
                        break;
                }
I don't understand your comment and relation to above warning.
I'd like to mention about below warning.
drivers/firmware/arm_scmi/clock.c: In function 'scmi_clock_protocol_init':
drivers/firmware/arm_scmi/clock.c:197:3: warning: 'rate' may be used uninitialized in this function [-Wmaybe-uninitialized]
 sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
The warning for line
quoted
quoted
+		sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
But, I think that it is affected by 'break' of below line. And for fixing this warning, I think we should fix inside this 'if' block.
quoted
                if (tot_rate_cnt + num_returned > SCMI_MAX_NUM_RATES) {
                        dev_err(handle->dev, "No. of rates > MAX_NUM_RATES");
                        break;
                }
Best regard,
DIEN Pham

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help