Skip to content

Commit 03270c6

Browse files
sudipm-mukherjeegregkh
authored andcommitted
parport: fix attempt to write duplicate procfiles
Usually every parallel port will have a single pardev registered with it. But ppdev driver is an exception. This userspace parallel port driver allows to create multiple parrallel port devices for a single parallel port. And as a result we were having a nice warning like: "sysctl table check failed: /dev/parport/parport0/devices/ppdev0/timeslice Sysctl already exists" Use the same logic as used in parport_register_device() and register the proc files only once for each parallel port. Fixes: 6fa45a2 ("parport: add device-model to parport subsystem") Cc: stable <[email protected]> # v4.4+ Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1414656 Bugzilla: https://bugs.archlinux.org/task/52322 Tested-by: James Feeney <[email protected]> Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent abda288 commit 03270c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/parport/share.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,8 +939,10 @@ parport_register_dev_model(struct parport *port, const char *name,
939939
* pardevice fields. -arca
940940
*/
941941
port->ops->init_state(par_dev, par_dev->state);
942-
port->proc_device = par_dev;
943-
parport_device_proc_register(par_dev);
942+
if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
943+
port->proc_device = par_dev;
944+
parport_device_proc_register(par_dev);
945+
}
944946

945947
return par_dev;
946948

0 commit comments

Comments
 (0)