Skip to content

Commit

Permalink
ptp: ocp: remove flash image header check fallback
Browse files Browse the repository at this point in the history
Previously there was a fallback mode to flash firmware image without
proper header. But now we have different supported vendors and flashing
wrong image could destroy the hardware. Remove fallback mode and force
header check. Both vendors have published firmware images with headers.

Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: Vadim Fedorenko <vadfed@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vadim Fedorenko authored and David S. Miller committed Oct 24, 2022
1 parent ee6439a commit c1fd463
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/ptp/ptp_ocp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1530,11 +1530,9 @@ ptp_ocp_devlink_fw_image(struct devlink *devlink, const struct firmware *fw,
hdr = (const struct ptp_ocp_firmware_header *)fw->data;
if (memcmp(hdr->magic, OCP_FIRMWARE_MAGIC_HEADER, 4)) {
devlink_flash_update_status_notify(devlink,
"No firmware header found, flashing raw image",
"No firmware header found, cancel firmware upgrade",
NULL, 0, 0);
offset = 0;
length = fw->size;
goto out;
return -EINVAL;
}

if (be16_to_cpu(hdr->pci_vendor_id) != bp->pdev->vendor ||
Expand Down Expand Up @@ -1562,7 +1560,6 @@ ptp_ocp_devlink_fw_image(struct devlink *devlink, const struct firmware *fw,
return -EINVAL;
}

out:
*data = &fw->data[offset];
*size = length;

Expand Down

0 comments on commit c1fd463

Please sign in to comment.