On Fri, Apr 05, 2019 at 07:13:00AM +0800, cgxu519 wrote: > On 4/5/19 3:08 AM, Dan Carpenter wrote: > > Hello Chengguang Xu, > > > > The patch 4b0be5726032: "chardev: code cleanup for > > __register_chrdev_region()" from Feb 15, 2019, leads to the following > > static checker warning: > > > > fs/char_dev.c:167 __register_chrdev_region() > > error: passing non negative 511 to ERR_PTR > > Hi Dan, > > Thanks for your report, I would like to know how did you trigger this? This a Smatch warning but you probably need to have the cross function DB built to see it. > IIUC, in the case of allocating dynamic major will not fail from minor > overlap check. Fine, but it's harmless to set "ret = -EBUSY;" before the goto out just to silence the warning. It would make the code more easy to understand as well. regards, dan carpenter