Adding too many devices with misc_register Device Driver

Asked by Ian Martin on 2018-08-08

Hey, I'm trying to add as many devices as I can with misc_register, which is just to expose some Mmaps that are done in the kernel, as a negative test, and it's consistently failing on the 54th device. Even if I tell it I want to put 60 devices with my device driver into the module. The error is "sysfs cannot create duplicate filename '/dev/char10:1'" because it already exists, and I am wondering if there is a limit I am hitting, or something that isn't getting set. After running this I also check /dev/char and cannot find a device matching that at all.

It doesn't seem to be limited by memory, as this happens both locally on a 32 GB dev machine, as well as in VM's with 8GB and 16 GB respectively, while also changing the size of the device I am making, from 128 MB to 64, and so on. The failure is consistently on the 54th device or the /dev/*53 device made when this error occurs.

Does anyone have any idea where this is from? All the references to this error I can find seem to be on mobile platforms like android, or with bluetooth devices, or direct pull requests into the linux kernel to add the error itself.

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Ian Martin
Last query:
Last reply:
Ian Martin (xaoc000) said : #1

This is on Ubuntu 16.04 and the Linux 4.13.07 kernel. Sorry

Ian Martin (xaoc000) said : #2

Fixed it, just limited number to 32 devices