Commit 063ab16f authored by Lukasz Luba's avatar Lukasz Luba Committed by Rafael J. Wysocki
Browse files

thermal: hisi: Use kcalloc() instead of kzalloc() with multiplication



According to the latest recommendations, kcalloc() should be used
instead of kzalloc() with multiplication (which might overflow).

Switch to this new scheme and use more safe kcalloc().

No functional impact.

Signed-off-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20250224173432.1946070-5-lukasz.luba@arm.com


[ rjw: Changelog edits ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e6c0525f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -412,8 +412,8 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)

	data->nr_sensors = 1;

	data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) *
				    data->nr_sensors, GFP_KERNEL);
	data->sensor = devm_kcalloc(dev, data->nr_sensors,
				    sizeof(*data->sensor), GFP_KERNEL);
	if (!data->sensor)
		return -ENOMEM;