Skip to content
Snippets Groups Projects
Commit c5eeb63e authored by Lakshmi Yadlapati's avatar Lakshmi Yadlapati Committed by Joel Stanley
Browse files

fsi: Fix panic on scom file read


Reading the scom file without the custom open method (i2cr_scom_open)
causes a kernel panic. This change replaces simple_open with i2cr_scom_open
to properly initialize the private_data field in the file structure,
preventing the panic during scom file operations.

Fixes: c0b34bed ("fsi: Add I2C Responder SCOM driver")
Signed-off-by: default avatarLakshmi Yadlapati <lakshmiy@us.ibm.com>
Reviewed-by: default avatarNinad Palsule <ninad@linux.ibm.com>
Link: https://lore.kernel.org/r/20231214000744.1281464-1-lakshmiy@us.ibm.com


Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
parent f7236a0c
No related merge requests found
......@@ -73,9 +73,18 @@ static ssize_t i2cr_scom_write(struct file *filep, const char __user *buf, size_
return len;
}
static int i2cr_scom_open(struct inode *inode, struct file *file)
{
struct i2cr_scom *scom = container_of(inode->i_cdev, struct i2cr_scom, cdev);
file->private_data = scom;
return 0;
}
static const struct file_operations i2cr_scom_fops = {
.owner = THIS_MODULE,
.open = simple_open,
.open = i2cr_scom_open,
.llseek = i2cr_scom_llseek,
.read = i2cr_scom_read,
.write = i2cr_scom_write,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment