]> git.baikalelectronics.ru Git - kernel.git/commit
platform/chrome: cros_ec_proto: check for NULL transfer function
authorEnrico Granata <egranata@chromium.org>
Wed, 3 Apr 2019 22:40:36 +0000 (15:40 -0700)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Mon, 15 Apr 2019 14:07:42 +0000 (16:07 +0200)
commit5d33403c1e1d53b54fc66902be2e479b7fbbf8a1
tree37485f53e13f38251383e3ee31f5072aa3c8b666
parent6f1e249573041b17738c90ffdd9840a812da712f
platform/chrome: cros_ec_proto: check for NULL transfer function

As new transfer mechanisms are added to the EC codebase, they may
not support v2 of the EC protocol.

If the v3 initial handshake transfer fails, the kernel will try
and call cmd_xfer as a fallback. If v2 is not supported, cmd_xfer
will be NULL, and the code will end up causing a kernel panic.

Add a check for NULL before calling the transfer function, along
with a helpful comment explaining how one might end up in this
situation.

Signed-off-by: Enrico Granata <egranata@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/platform/chrome/cros_ec_proto.c