Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fzhou-nokia
Copy link
Contributor

[H5-64D]:

  • Add driver for SysFPGA, CPUPLD, SWPLD2/3
  • Add driver for PSU and EEPROMs
  • Update init script and sfp, eeprom, fan, psu modules
  • Update thermal info, firmware upgrade and watchdog modules
  • Add support for port LED
  • Update thermal algorithm
  • Add unit tests

@fzhou-nokia fzhou-nokia marked this pull request as ready for review December 12, 2024 19:18
@fzhou-nokia
Copy link
Contributor Author

fzhou-nokia commented Dec 12, 2024

@jon-nokia @mlok-nokia @Pavan-Nokia please help to review and merge
Thank you!

fpga->buffer = kmalloc(BUF_SIZE * sizeof(char), GFP_KERNEL);
if (!fpga->buffer)
{
dev_warn(&dev->dev, "Couldn't allocate memory for buffer!\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing kfree(fpga)

Copy link
Collaborator

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));
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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)
Copy link
Collaborator

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)"

Copy link
Collaborator

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????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants