Skip to content

Commit

Permalink
Fix driver errors
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Nov 15, 2023
1 parent 93488f3 commit f35eff8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions openemc-driver/openemc.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,15 @@ static int openemc_flash_firmware_page(struct openemc *emc,
{
u32 addr = start + page;
u32 i, flash_crc32, firmware_crc32;
u8 page_data[page_size];
u8 page_data[OPENEMC_MAX_PAGE_SIZE];
u8 len, status;
int ret;

dev_info(emc->dev, "flashing 0x%08x - 0x%08x\n", addr,
addr + page_size - 1);

if (page_size > OPENEMC_MAX_PAGE_SIZE)
return -EINVAL;
for (i = 0; i < page_size; i++) {
if (page + i < firmware->size)
page_data[i] = firmware->data[page + i];
Expand Down Expand Up @@ -1513,10 +1515,10 @@ static struct attribute *openemc_attrs[] = {
&dev_attr_openemc_firmware.attr,
&dev_attr_openemc_version.attr,
&dev_attr_openemc_bootloader_version.attr,
&dev_attr_openemc_bootloader_crc32,
&dev_attr_openemc_bootloader_crc32.attr,
&dev_attr_openemc_copyright.attr,
&dev_attr_openemc_flashable.attr,
&dev_attr_openemc_flash_size,
&dev_attr_openemc_flash_size.attr,
&dev_attr_openemc_emc_model.attr,
&dev_attr_openemc_board_model.attr,
&dev_attr_openemc_unique_id.attr,
Expand Down
1 change: 1 addition & 0 deletions openemc-driver/openemc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define OPENEMC_MAX_DATA_SIZE 32
#define OPENEMC_MAX_CELLS 32
#define OPENEMC_MAX_RETRIES 5
#define OPENEMC_MAX_PAGE_SIZE 4096

#define OPENEMC_IRQS 32
#define OPENEMC_EXT_IRQS 16
Expand Down

0 comments on commit f35eff8

Please sign in to comment.