Commit 2ff90100 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hwmon-for-v5.11-rc3' of...

Merge tag 'hwmon-for-v5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - Fix possible KASAN issue in amd_energy driver

 - Avoid configuration problem in pwm-fan driver

 - Fix kernel-doc warning in sbtsi_temp documentation

* tag 'hwmon-for-v5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (amd_energy) fix allocation of hwmon_channel_info config
  hwmon: (pwm-fan) Ensure that calculation doesn't discard big period values
  hwmon: (sbtsi_temp) Fix Documenation kernel-doc warning
parents f408126b 84e26155
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0-or-later
.. SPDX-License-Identifier: GPL-2.0-or-later


Kernel driver sbtsi_temp
Kernel driver sbtsi_temp
==================
========================


Supported hardware:
Supported hardware:


+2 −1
Original line number Original line Diff line number Diff line
@@ -222,7 +222,7 @@ static int amd_create_sensor(struct device *dev,
	 */
	 */
	cpus = num_present_cpus() / num_siblings;
	cpus = num_present_cpus() / num_siblings;


	s_config = devm_kcalloc(dev, cpus + sockets,
	s_config = devm_kcalloc(dev, cpus + sockets + 1,
				sizeof(u32), GFP_KERNEL);
				sizeof(u32), GFP_KERNEL);
	if (!s_config)
	if (!s_config)
		return -ENOMEM;
		return -ENOMEM;
@@ -254,6 +254,7 @@ static int amd_create_sensor(struct device *dev,
			scnprintf(label_l[i], 10, "Esocket%u", (i - cpus));
			scnprintf(label_l[i], 10, "Esocket%u", (i - cpus));
	}
	}


	s_config[i] = 0;
	return 0;
	return 0;
}
}


+11 −1
Original line number Original line Diff line number Diff line
@@ -334,8 +334,18 @@ static int pwm_fan_probe(struct platform_device *pdev)


	ctx->pwm_value = MAX_PWM;
	ctx->pwm_value = MAX_PWM;


	/* Set duty cycle to maximum allowed and enable PWM output */
	pwm_init_state(ctx->pwm, &state);
	pwm_init_state(ctx->pwm, &state);
	/*
	 * __set_pwm assumes that MAX_PWM * (period - 1) fits into an unsigned
	 * long. Check this here to prevent the fan running at a too low
	 * frequency.
	 */
	if (state.period > ULONG_MAX / MAX_PWM + 1) {
		dev_err(dev, "Configured period too big\n");
		return -EINVAL;
	}

	/* Set duty cycle to maximum allowed and enable PWM output */
	state.duty_cycle = ctx->pwm->args.period - 1;
	state.duty_cycle = ctx->pwm->args.period - 1;
	state.enabled = true;
	state.enabled = true;