2003-05-09 08:11:23

by norbert_wolff

[permalink] [raw]
Subject: Bogus Warning in ppp_generic.c

Hi !

If devfs is not configured, devfs_mk_cdev returns 0.
The ppp_generic-Driver reports a bogus Warning in this case.
Fix below.

Regards,

Norbert


--- ppp_generic.c.orig 2003-05-09 09:16:56.%N +0200
+++ ppp_generic.c 2003-05-09 10:09:19.%N +0200
@@ -784,10 +784,13 @@ int __init ppp_init(void)

printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
+
+#ifdef CONFIG_DEVFS_FS
if (!err) {
err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
}
+#endif

if (!err)
printk(KERN_ERR "failed to register PPP device (%d)\n", err);


--
Norbert Wolff
OpenPGP-Key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF13BD6F6


2003-05-09 08:19:32

by Christoph Hellwig

[permalink] [raw]
Subject: Re: Bogus Warning in ppp_generic.c

On Fri, May 09, 2003 at 10:24:01AM +0200, Norbert Wolff wrote:
> printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
> err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
> +
> +#ifdef CONFIG_DEVFS_FS
> if (!err) {
> err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
> S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
> }
> +#endif
>
> if (!err)
> printk(KERN_ERR "failed to register PPP device (%d)\n", err);

Wrong fix :) the error check is just reveresed, devfs_mk_cdev also returns
0 if CONFIG_DEVFS_FS is set and it succeded.

Btw, almost any occurance of #ifdef CONFIG_DEVFS_FS is a bug.