Re: [PATCH v9 5/7] ACPI: APEI: EINJ: Create debugfs files to enter device id and syndrome
From: Dan Carpenter
Date: Wed Jun 18 2025 - 11:23:24 EST
On Thu, Jun 12, 2025 at 04:13:25PM -0700, Zaid Alali wrote:
> +static ssize_t u128_read(struct file *f, char __user *buf, size_t count, loff_t *off)
> +{
> + char output[2 * COMPONENT_LEN + 1];
> + u8 *data = f->f_inode->i_private;
> + int i;
> +
> + if (*off >= sizeof(output))
> + return 0;
No need for this check. simple_read_from_buffer() will do the
right thing.
regards,
dan carpenter
> +
> + for (i = 0; i < COMPONENT_LEN; i++)
> + sprintf(output + 2 * i, "%.02x", data[COMPONENT_LEN - i - 1]);
> + output[2 * COMPONENT_LEN] = '\n';
> +
> + return simple_read_from_buffer(buf, count, off, output, sizeof(output));
> +}