Re: [PATCH] remoteproc: warn on kick missing
From: nikita . shubin
Date: Thu Feb 06 2020 - 05:45:35 EST
Sorry for malformed message, please ignore it.
06.02.2020, 08:53, "Nikita Shubin" <nshubin@xxxxxxxxxx>:
> .kick method not set in rproc_ops will result in:
>
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference
>
> in rproc_virtio_notify, after firmware loading.
>
> At least a warning needed on attempt to call missing method.
>
> Signed-off-by: Nikita Shubin <NShubin@xxxxxxxxxx>
> ---
> Âdrivers/remoteproc/remoteproc_virtio.c | 6 ++++++
> Â1 file changed, 6 insertions(+)
>
> diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
> index 8c07cb2ca8ba..77a81f331e3f 100644
> --- a/drivers/remoteproc/remoteproc_virtio.c
> +++ b/drivers/remoteproc/remoteproc_virtio.c
> @@ -32,6 +32,12 @@ static bool rproc_virtio_notify(struct virtqueue *vq)
>
> ÂÂÂÂÂÂÂÂdev_dbg(&rproc->dev, "kicking vq index: %d\n", notifyid);
>
> + if (unlikely(rproc->ops->kick == NULL)) {
> + WARN_ONCE(rproc->ops->kick == NULL, ".kick method not defined for %s",
> + rproc->name);
> + return false;
> + }
> +
> ÂÂÂÂÂÂÂÂrproc->ops->kick(rproc, notifyid);
> ÂÂÂÂÂÂÂÂreturn true;
> Â}
> --
> 2.24.1
>
> Confidentiality Notice: This message (including attachments) is a private communication solely for use of the intended recipient(s). If you are not the intended recipient(s) or believe you received this message in error, notify the sender immediately and then delete this message. Any other use, retention, dissemination or copying is prohibited and may be a violation of law, including the Electronic Communication Privacy Act of 1986. ÂÂ