From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753712AbdKHVCM (ORCPT ); Wed, 8 Nov 2017 16:02:12 -0500 Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:8812 "EHLO omzsmtpe02.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752836AbdKHVCB (ORCPT ); Wed, 8 Nov 2017 16:02:01 -0500 X-Host: mariner.tdc.vzwcorp.com From: "Levin, Alexander (Sasha Levin)" To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jason Hrycay , Greg Kroah-Hartman , "Levin, Alexander (Sasha Levin)" Subject: [PATCH AUTOSEL for-4.9 47/53] staging: greybus: add host device function pointer checks Thread-Topic: [PATCH AUTOSEL for-4.9 47/53] staging: greybus: add host device function pointer checks Thread-Index: AQHTWNMok5dPhO2CRUutSSzMZux7uw== Date: Wed, 8 Nov 2017 20:50:06 +0000 Message-ID: <20171108204940.27321-47-alexander.levin@verizon.com> References: <20171108204940.27321-1-alexander.levin@verizon.com> In-Reply-To: <20171108204940.27321-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vA8L3dYE003822 From: Jason Hrycay [ 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 Reviewed-by: Bryan O'Donoghue Acked-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/greybus/connection.c | 6 ++++++ 1 file changed, 6 insertions(+) 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", -- 2.11.0