virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Amit Shah <amit.shah@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	virtualization@lists.linux-foundation.org
Subject: [PATCH 3/6] virtio/console: verify device has config space
Date: Tue, 13 Jan 2015 16:43:18 +0200	[thread overview]
Message-ID: <1421160167-18498-4-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1421160167-18498-1-git-send-email-mst@redhat.com>

Some devices might not implement config space access
(e.g. remoteproc used not to - before 3.9).
virtio/console needs config space access so make it
fail gracefully if not there.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/char/virtio_console.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index de03df9..26afb56 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1986,6 +1986,12 @@ static int virtcons_probe(struct virtio_device *vdev)
 	bool multiport;
 	bool early = early_put_chars != NULL;
 
+	if (!vdev->config->get) {
+		dev_err(&vdev->dev, "%s failure: config access disabled\n",
+			__func__);
+		return -EINVAL;
+	}
+
 	/* Ensure to read early_put_chars now */
 	barrier();
 
-- 
MST

  parent reply	other threads:[~2015-01-13 14:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1421160167-18498-1-git-send-email-mst@redhat.com>
2015-01-13 14:43 ` [PATCH 1/6] virtio/9p: verify device has config space Michael S. Tsirkin
2015-01-13 14:43 ` [PATCH 2/6] virtio/blk: " Michael S. Tsirkin
2015-01-13 14:43 ` Michael S. Tsirkin [this message]
2015-01-13 14:43 ` [PATCH 4/6] virtio/net: " Michael S. Tsirkin
2015-01-13 14:43 ` [PATCH 5/6] virtio/scsi: " Michael S. Tsirkin
2015-01-13 14:43 ` [PATCH 6/6] virtio/balloon: " Michael S. Tsirkin
2015-01-13 14:43 ` Michael S. Tsirkin
2015-01-13 19:49 ` [PATCH 0/6] virtio: graceful failure with get == NULL Michael S. Tsirkin
2015-01-20  6:29   ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421160167-18498-4-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).