diff mbox

rpmsg: virtio_rpmsg_bus: fix announce for devices without endpoint

Message ID 1496403351-32280-1-git-send-email-henri.roosen@ginzinger.com (mailing list archive)
State Accepted
Headers show

Commit Message

Henri Roosen June 2, 2017, 11:35 a.m. UTC
A device might not have an endpoint assigned. This patch checks if
rpdev->ept has a value before dereferencing or using it.

Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com>
---
 drivers/rpmsg/virtio_rpmsg_bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bjorn Andersson June 25, 2017, 9:35 p.m. UTC | #1
On Fri 02 Jun 04:35 PDT 2017, Henri Roosen wrote:

> A device might not have an endpoint assigned. This patch checks if
> rpdev->ept has a value before dereferencing or using it.
> 

Applied, thanks.

> Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com>
> ---
>  drivers/rpmsg/virtio_rpmsg_bus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 5e66e081..3c582f2 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -314,7 +314,7 @@ static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
>  	int err = 0;
>  
>  	/* need to tell remote processor's name service about this channel ? */
> -	if (rpdev->announce &&
> +	if (rpdev->announce && rpdev->ept &&
>  	    virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
>  		struct rpmsg_ns_msg nsm;
>  
> @@ -338,7 +338,7 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
>  	int err = 0;
>  
>  	/* tell remote processor's name service we're removing this channel */
> -	if (rpdev->announce &&
> +	if (rpdev->announce && rpdev->ept &&
>  	    virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
>  		struct rpmsg_ns_msg nsm;
>  
> -- 
> 2.1.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 5e66e081..3c582f2 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -314,7 +314,7 @@  static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
 	int err = 0;
 
 	/* need to tell remote processor's name service about this channel ? */
-	if (rpdev->announce &&
+	if (rpdev->announce && rpdev->ept &&
 	    virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
 		struct rpmsg_ns_msg nsm;
 
@@ -338,7 +338,7 @@  static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
 	int err = 0;
 
 	/* tell remote processor's name service we're removing this channel */
-	if (rpdev->announce &&
+	if (rpdev->announce && rpdev->ept &&
 	    virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
 		struct rpmsg_ns_msg nsm;