]> asedeno.scripts.mit.edu Git - linux.git/commit
USB: io_ti: Add firmware image sanity checks
authorPeter E. Berger <pberger@brimson.com>
Fri, 31 Jul 2015 06:55:07 +0000 (01:55 -0500)
committerJohan Hovold <johan@kernel.org>
Fri, 31 Jul 2015 10:09:41 +0000 (12:09 +0200)
commitdcb8e99dbc8a8a7825e39a43e79558d46b20d1e5
treef50b3a64c7097b66bbee88e54cc51ea60d44f6e7
parentc0e34831c8d9d8bf24f7bc9e12663e3daf1646ef
USB: io_ti: Add firmware image sanity checks

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: Peter E. Berger <pberger@brimson.com>
[johan: drop redundant checksum mask ]
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/io_ti.c