diff options
author | Jason Hrycay <jhrycay@gmail.com> | 2016-12-20 14:49:27 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-21 09:23:27 +0100 |
commit | b53bab72b9d8f1f07a30774c06685cd6e57e8f69 (patch) | |
tree | cb85a8b732e9dfc2325e707b44a010cb715e5d6e | |
parent | 1f5a7caba79eb47207c94bb43c645714bf3e8ebe (diff) | |
download | linux-stable-b53bab72b9d8f1f07a30774c06685cd6e57e8f69.tar.gz linux-stable-b53bab72b9d8f1f07a30774c06685cd6e57e8f69.tar.bz2 linux-stable-b53bab72b9d8f1f07a30774c06685cd6e57e8f69.zip |
staging: greybus: add host device function pointer checks
[ Upstream commit f05a88a39c5b5f226e08e626998bb920723b7d85 ]
Add sanity checks for cport_quiesce and cport_clear before invoking the
callbacks as these function pointers are not required during the host
device registration. This follows the logic implemented elsewhere for
various other function pointers.
Signed-off-by: Jason Hrycay <jhrycay@gmail.com>
Reviewed-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/greybus/connection.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 557075147f2d..1bf0ee403106 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -357,6 +357,9 @@ static int gb_connection_hd_cport_quiesce(struct gb_connection *connection) size_t peer_space; int ret; + if (!hd->driver->cport_quiesce) + return 0; + peer_space = sizeof(struct gb_operation_msg_hdr) + sizeof(struct gb_cport_shutdown_request); @@ -380,6 +383,9 @@ static int gb_connection_hd_cport_clear(struct gb_connection *connection) struct gb_host_device *hd = connection->hd; int ret; + if (!hd->driver->cport_clear) + return 0; + ret = hd->driver->cport_clear(hd, connection->hd_cport_id); if (ret) { dev_err(&hd->dev, "%s: failed to clear host cport: %d\n", |