mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
thermal: intel: int340x: simplify ptc_temperature_write()
Simplify 'ptc_temperature_write()' by using the convenient 'kstrtou32_from_user()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Link: https://patch.msgid.link/20260702160240.2929965-1-dmantipov@yandex.ru Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
5cc6da534c
commit
f1e50b1bcc
|
|
@ -227,17 +227,12 @@ static ssize_t ptc_temperature_write(struct file *file, const char __user *data,
|
|||
{
|
||||
struct ptc_data *ptc_instance = file->private_data;
|
||||
struct pci_dev *pdev = ptc_instance->pdev;
|
||||
char buf[32];
|
||||
ssize_t len;
|
||||
u32 value;
|
||||
int ret;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, data, len))
|
||||
return -EFAULT;
|
||||
|
||||
buf[len] = '\0';
|
||||
if (kstrtouint(buf, 0, &value))
|
||||
return -EINVAL;
|
||||
ret = kstrtou32_from_user(data, count, 0, &value);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
if (ptc_mmio_regs[PTC_TEMP_OVERRIDE_INDEX].units)
|
||||
value /= ptc_mmio_regs[PTC_TEMP_OVERRIDE_INDEX].units;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user