Skip to content

Commit f05a88a

Browse files
jhrycaygregkh
authored andcommitted
staging: greybus: add host device function pointer checks
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 <[email protected]> Reviewed-by: Bryan O'Donoghue <[email protected]> Acked-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a072a72 commit f05a88a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/staging/greybus/connection.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ static int gb_connection_hd_cport_quiesce(struct gb_connection *connection)
357357
size_t peer_space;
358358
int ret;
359359

360+
if (!hd->driver->cport_quiesce)
361+
return 0;
362+
360363
peer_space = sizeof(struct gb_operation_msg_hdr) +
361364
sizeof(struct gb_cport_shutdown_request);
362365

@@ -380,6 +383,9 @@ static int gb_connection_hd_cport_clear(struct gb_connection *connection)
380383
struct gb_host_device *hd = connection->hd;
381384
int ret;
382385

386+
if (!hd->driver->cport_clear)
387+
return 0;
388+
383389
ret = hd->driver->cport_clear(hd, connection->hd_cport_id);
384390
if (ret) {
385391
dev_err(&hd->dev, "%s: failed to clear host cport: %d\n",

0 commit comments

Comments
 (0)