ARM SCMI fixes/cleanups for v4.17

Couple of fixes for build warning due to uninitialised variable
 and static checker warning for passing NULL pointer to PTR_ERR.
 It also contains cleanup suggested by Stephen Boyd in SCMI clock
 driver using the new devm_of_clk_add_hw_provider() API.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJasTqmAAoJEABBurwxfuKYoJEP/Reu05gZud5fcIwGId0GK3a+
 AuIqTNXmDSVTU8fOv78Pv7OgYGBmAYTuBIJ/ji3ox/wFpjhb1JrZDA/o6WLJuPsN
 EEt562TMNUN0bfZx4E+heUpqXpOdFchgjP6+OsOeLWk1JXK3AvTTY2z/hbwgaw5H
 gey4+oayxof47OH5UNOlbdbjzOLuGZGPlnEWlbxppm28+QHENRITdzogYDkkHJiQ
 IGa+fLMErXcmeNKYsorKH+OejEfVoe+K8lvo1s1YDAMYCAkHibu7d62ryf/cFW7H
 uj6yKLWXa92TEwqcSNIV0IM+xlX8e2kpeNuVbpTxXU1yYWLaEIVV5022VFCv7Z0G
 jR53V98sYfThmKVM/vJjr2AkSWhM6DmlUx15WvrnthRtHOcW3uUxnrMk84EDCntg
 eUX9Z7xevmdDz5k8uq6DYAvoImPrKU+yscJiAVBA0CZg8fi5cqAms7XGgY9dPzTD
 B4VIm8a4cmGMXpShZI2T/qKpJbPahKi4U9Yf134FAEuBufQ7oIFERwzzu039PQ5e
 0ZqLyFx7ZOnxr+cfpQKRTHFJBPRLSRAW5yI2Qh8szmZAcMzgcbsho9tvSsUer8GQ
 qYnXiX7IPJb9wcc0/dyku0oHEz8vIx/t2YqJzOfBKfYZSv2L8EdFkD1jRUU3B8K/
 BX0TAFjb7/6Y/CvUZIE4
 =Gvhw
 -----END PGP SIGNATURE-----

Merge tag 'scmi-fixes-4.17' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into next/drivers

Pull "ARM SCMI fixes/cleanups for v4.17" from Sudeep Holla:

Couple of fixes for build warning due to uninitialised variable
and static checker warning for passing NULL pointer to PTR_ERR.
It also contains cleanup suggested by Stephen Boyd in SCMI clock
driver using the new devm_of_clk_add_hw_provider() API.

* tag 'scmi-fixes-4.17' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  clk: scmi: use devm_of_clk_add_hw_provider() API and drop scmi_clocks_remove
  firmware: arm_scmi: prevent accessing rate_discrete uninitialized
  hwmon: (scmi) return -EINVAL when sensor information is unavailable
This commit is contained in:
Arnd Bergmann 2018-03-27 15:57:19 +02:00
commit f8d6dc78b8
3 changed files with 6 additions and 13 deletions

View file

@ -172,15 +172,8 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
}
}
return of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data);
}
static void scmi_clocks_remove(struct scmi_device *sdev)
{
struct device *dev = &sdev->dev;
struct device_node *np = dev->of_node;
of_clk_del_provider(np);
return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
clk_data);
}
static const struct scmi_device_id scmi_id_table[] = {
@ -192,7 +185,6 @@ MODULE_DEVICE_TABLE(scmi, scmi_id_table);
static struct scmi_driver scmi_clocks_driver = {
.name = "scmi-clocks",
.probe = scmi_clocks_probe,
.remove = scmi_clocks_remove,
.id_table = scmi_id_table,
};
module_scmi_driver(scmi_clocks_driver);

View file

@ -125,7 +125,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
{
u64 *rate;
int ret, cnt;
bool rate_discrete;
bool rate_discrete = false;
u32 tot_rate_cnt = 0, rates_flag;
u16 num_returned, num_remaining;
struct scmi_xfer *t;
@ -147,7 +147,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
ret = scmi_do_xfer(handle, t);
if (ret)
break;
goto err;
rates_flag = le32_to_cpu(rlist->num_rates_flags);
num_remaining = NUM_REMAINING(rates_flag);
@ -185,6 +185,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
if (rate_discrete)
clk->list.num_rates = tot_rate_cnt;
err:
scmi_one_xfer_put(handle, t);
return ret;
}

View file

@ -138,7 +138,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
for (i = 0; i < nr_sensors; i++) {
sensor = handle->sensor_ops->info_get(handle, i);
if (!sensor)
return PTR_ERR(sensor);
return -EINVAL;
switch (sensor->type) {
case TEMPERATURE_C: