public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	gregkh@linuxfoundation.org
Subject: Re: [ppdev] sysfs warning on qemu boot
Date: Fri, 11 Nov 2016 21:14:07 +0000	[thread overview]
Message-ID: <5826349F.80408@gmail.com> (raw)
In-Reply-To: <0d71c0da-d888-85b0-2e77-ad5064c5e0bb@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

Hi Joe,

On Wednesday 09 November 2016 06:41 PM, Joe Lawrence wrote:
> On 11/09/2016 12:04 PM, Sudip Mukherjee wrote:
>> Hi Joe,
>>
>> On 09/11/16 16:00, Joe Lawrence wrote:
>>> Hi Sudip,
>>>
>>> I hit a sysfs_warn_dup inside QEMU running 4.9.0-rc4 (I suspect earlier
>>> versions as well, but this is the first upstream I've run in a while).
>>> This warning looks like something the kernel test robot ran into a few
>>> months ago:
>>
>> Yes, 0day reported, but I was unable to reproduce it with the config
>> file that was given. Can you please send me your .config file and I will
>> try to reproduce this on my setup, and if I am not able to then i will
>> have to disturb you for debugging and testing.

Can you please test the attached patch and try to reproduce the error...
Sorry I could not test it as i could not build using your .config, I 
guess its time for me to upgrade gcc.

Regards
Sudip


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1219 bytes --]

diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index d233688..6755887 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -86,6 +86,9 @@ struct pp_struct {
 	long default_inactivity;
 };
 
+/* should we use PARDEVICE_MAX here */
+static struct device *devices[PARPORT_MAX];
+
 /* pp_struct.flags bitfields */
 #define PP_CLAIMED    (1<<0)
 #define PP_EXCL       (1<<1)
@@ -792,13 +795,29 @@ static unsigned int pp_poll(struct file *file, poll_table *wait)
 
 static void pp_attach(struct parport *port)
 {
-	device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number),
-		      NULL, "parport%d", port->number);
+	struct device *ret;
+
+	if (devices[port->number])
+		return;
+
+	ret = device_create(ppdev_class, port->dev,
+			    MKDEV(PP_MAJOR, port->number), NULL,
+			    "parport%d", port->number);
+	if (IS_ERR(ret)) {
+		pr_err("Failed to create device parport%d\n",
+		       port->number);
+		return;
+	}
+	devices[port->number] = ret;
 }
 
 static void pp_detach(struct parport *port)
 {
+	if (!devices[port->number])
+		return;
+
 	device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number));
+	devices[port->number] = NULL;
 }
 
 static int pp_probe(struct pardevice *par_dev)

  reply	other threads:[~2016-11-11 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 16:00 [ppdev] sysfs warning on qemu boot Joe Lawrence
2016-11-09 17:04 ` Sudip Mukherjee
2016-11-09 18:41   ` Joe Lawrence
2016-11-11 21:14     ` Sudip Mukherjee [this message]
2016-11-11 22:16       ` Joe Lawrence

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=5826349F.80408@gmail.com \
    --to=sudipm.mukherjee@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe.lawrence@redhat.com \
    --cc=linux-kernel@vger.kernel.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