From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Arun Kumar Neelakantam Subject: [PATCH V5 2/5] rpmsg: Guard against null endpoint ops in destroy Date: Fri, 22 Nov 2019 10:05:13 +0000 Message-ID: <0101016e9292a1af-f408df27-58cd-44b1-8258-a7090ec77c30-000000@us-west-2.amazonses.com> In-Reply-To: <1574417087-27594-1-git-send-email-aneela@codeaurora.org> References: <1574417087-27594-1-git-send-email-aneela@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org To: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org, sricharan@codeaurora.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam List-ID: From: Chris Lew In RPMSG GLINK the chrdev device will allocate an ept as part of the rpdev creation. This device will not register endpoint ops even though it has an allocated ept. Protect against the case where the device is being destroyed. Signed-off-by: Chris Lew Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/rpmsg_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index e330ec4..d6c3275 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -81,7 +81,7 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev, */ void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) { - if (ept) + if (ept && ept->ops) ept->ops->destroy_ept(ept); } EXPORT_SYMBOL(rpmsg_destroy_ept); -- 1.9.1