• Peter E. Berger's avatar
    USB: io_ti: Add firmware image sanity checks · dcb8e99d
    Peter E. Berger authored
    Do what we can to verify that the driver's firmware image is valid
    (before attempting to download it to the Edgeport) by adding a new
    function, check_fw_sanity(), and a call to it in in download_fw().
    
    Note: It looks like some Edgeports (models like the EP/416 with on-board
    E2PROM) may be able to function even if the on-disk firmware image is
    bad or missing, iff their local E2PROM versions are valid.  But most
    Edgeport models (I've tried EP/1 and EP/8) do not appear to have this
    capability and they always rely on the on-disk firmware image.
    
    I tested an implementation that calls the new check_fw_sanity()
    function at the top of download_fw() and, rather than simply returning
    an error if the firmware image is bad or missing, it saves the result
    and defers the decision until later when it may find that it is running
    on a E2PROM-equipped device with a valid image.  But I think this is
    messier than it is worth (adding still more messiness to the already
    very messy download_fw()) for such a marginal possible benefit.  So, at
    least for now, I have chosen the much simpler approach of returning an
    error whenever edge_startup() fails to load an on-disk firmware image, or
    check_fw_sanity() indicates that it is unusable.
    Signed-off-by: default avatarPeter E. Berger <pberger@brimson.com>
    [johan: drop redundant checksum mask ]
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    dcb8e99d
io_ti.c 73 KB