Eliav Farber 81114fc3d2 hwmon: (mr75203) fix VM sensor allocation when "intel,vm-map" not defined
Bug - in case "intel,vm-map" is missing in device-tree ,'num' is set
to 0, and no voltage channel infos are allocated.

The reason num is set to 0 when "intel,vm-map" is missing is to set the
entire pvt->vm_idx[] with incremental channel numbers, but it didn't
take into consideration that same num is used later in devm_kcalloc().

If "intel,vm-map" does exist there is no need to set the unspecified
channels with incremental numbers, because the unspecified channels
can't be accessed in pvt_read_in() which is the only other place besides
the probe functions that uses pvt->vm_idx[].

This change fixes the bug by moving the incremental channel numbers
setting to be done only if "intel,vm-map" property is defined (starting
loop from 0), and removing 'num = 0'.

Fixes: 9d823351a337 ("hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller")
Signed-off-by: Eliav Farber <farbere@amazon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220908152449.35457-3-farbere@amazon.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-08 11:54:04 -07:00
..
2022-09-03 13:23:11 -07:00
2022-08-04 12:12:54 -07:00
2022-08-04 19:30:35 -07:00
2022-07-17 17:14:30 -07:00
2022-08-04 19:30:35 -07:00
2022-08-06 16:38:17 -07:00
2022-08-31 09:54:14 -07:00
2022-08-05 10:07:23 -07:00
2022-09-03 13:09:46 -07:00
2022-08-18 17:37:22 +02:00
2022-08-26 11:05:54 -07:00
2022-08-04 19:41:09 -07:00
2022-08-06 10:25:16 -07:00
2022-09-02 15:03:12 -07:00
2022-08-05 14:13:45 -07:00
2022-09-02 10:55:23 -07:00
2022-08-12 09:50:34 -07:00
2022-09-02 16:44:30 -07:00
2022-08-04 12:12:54 -07:00
2022-08-03 17:49:38 +02:00
2022-09-02 10:32:30 -07:00
2022-08-04 19:30:35 -07:00
2022-09-02 10:35:51 -07:00
2022-08-04 12:12:54 -07:00
2022-08-04 12:12:54 -07:00
2022-08-16 11:36:38 -07:00
2022-08-05 10:02:33 -07:00
2022-08-09 00:56:41 +02:00
2022-08-20 11:29:01 -07:00
2022-08-16 11:40:15 -07:00
2022-08-13 13:41:48 -07:00
2022-08-27 15:07:58 +02:00
2022-08-12 09:50:34 -07:00
2022-08-08 15:04:04 -07:00
2022-09-03 13:23:11 -07:00
2022-08-04 12:01:42 -07:00