-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[H5-64D]Update Nokia Platform modules after OC tests #19
base: main
Are you sure you want to change the base?
Conversation
@jon-nokia @mlok-nokia @Pavan-Nokia please help to review and merge |
fpga->buffer = kmalloc(BUF_SIZE * sizeof(char), GFP_KERNEL); | ||
if (!fpga->buffer) | ||
{ | ||
dev_warn(&dev->dev, "Couldn't allocate memory for buffer!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing kfree(fpga)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact many other memory leaks with dev_err() .... return ret in other places.
release_region(fpga->pci_base, fpga->pci_size); | ||
|
||
out_kfree: | ||
kfree((fpga)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing kfree(fpga->buffer)
#ifdef FPGA_ATTR | ||
fpga_attr_exit(); | ||
#endif | ||
kfree(fpga); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kfree(fpga->buffer)
//ret = (chip->buffer[bank] >> pin) & 0x1; | ||
rdata = ioread32(chip->bar + reg); | ||
ret = (rdata >> bit) & 0x1; | ||
//printk(KERN_INFO "gpio = 0x%x chip->bar = 0x%x value = 0x%x", gpio, chip->bar, rdata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use dev_dbg() function instead of //printk
} | ||
else | ||
{ | ||
// dni_fpga_i2c_read(i2c, addr, command, 1, &data->byte, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused code
rw_data = (data[i * 4 + 3] << 24) | (data[i * 4 + 2] << 16) | (data[i * 4 + 1] << 8) | data[i * 4 + 0]; | ||
delta_fpga_i2c_data_reg_set(i2c, offset, rw_data); | ||
} | ||
// printk(KERN_INFO "four_byte : rw_data = 0x%lx",rw_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use dev_dbg()
status = io_read(i2c, DELTA_I2C_CTRL(i2c->offset)); | ||
if ((status & I2C_TRANS_FAIL)) | ||
{ | ||
//printk(KERN_ERR "I2C read failed:addr_data=0x%lx, ctrl_data=0x%lx, status=0x%lx ",addr_data, ctrl_data ,status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use dev_err()
|
||
fpga->i2c = kzalloc(sizeof(struct i2c_bus_dev) * num_i2c_adapter, GFP_KERNEL); | ||
|
||
if (!fpga) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "if (!fpga->i2c)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and where is this kzalloc ever free'd????
[H5-64D]: