From: Chris Lew Date: Wed, 24 Jun 2020 16:45:19 +0000 (+0530) Subject: rpmsg: Guard against null endpoint ops in destroy X-Git-Tag: v5.10-rc1~54^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d5158cda9e7b66fd412815df32e58943b7383f0c;p=thirdparty%2Flinux.git rpmsg: Guard against null endpoint ops in destroy 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 Signed-off-by: Deepak Kumar Singh Link: https://lore.kernel.org/r/1593017121-7953-3-git-send-email-deesin@codeaurora.org Signed-off-by: Bjorn Andersson --- diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index a6361cad608b1..91de940896e3d 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -81,7 +81,7 @@ EXPORT_SYMBOL(rpmsg_create_ept); */ void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) { - if (ept) + if (ept && ept->ops) ept->ops->destroy_ept(ept); } EXPORT_SYMBOL(rpmsg_destroy_ept);