Messages in this thread | | | Date | Thu, 9 Jun 2022 15:18:17 +0200 | From | Greg KH <> | Subject | Re: [PATCH] tty: nozomi: Return an error when failing to create the sysfs |
| |
On Thu, Jun 09, 2022 at 07:03:32PM +0800, Zheyu Ma wrote: > On Thu, Jun 9, 2022 at 4:38 PM Greg KH <gregkh@linuxfoundation.org> wrote: > > > > On Thu, Jun 09, 2022 at 04:31:33PM +0800, Zheyu Ma wrote: > > > The driver does not handle the error of the creation of sysfs, resulting > > > in duplicate file names being created. > > > > > > The following log can reveal it: > > > > > > [ 52.907211] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:05.0/card_type' > > > > How is the same file being created in a normal codepath? > > > > Is the same device being registered twice somehow? > > In fact, I tried to load the nozomi driver twice.
How? Modules should not be able to be in memory twice.
> In the first load, the driver failed at tty_port_register_device(), > performed error handling and returned an error, but by this time the > make_sysfs_files() had been executed and the sysfs had been created. > In the second load, the make_sysfs_files() is executed again and this > warning is returned.
Ah, ok, if you make the other changes I suggested, this will not be a problem.
thanks,
greg k-h
| |