Re: [PATCH] staging: wilc1000: fix undefined reference to `__this_module' compilation error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 09, 2018 at 01:08:38PM +0300, Dan Carpenter wrote:
> On Thu, Aug 09, 2018 at 12:13:06PM +0530, Ajay Singh wrote:
> >  	wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
> > -	for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
> > -		info = &debugfs_info[i];
> > -		debugfs_create_file(info->name,
> > -				    info->perm,
> > -				    wilc_dir,
> > -				    &info->data,
> > -				    &info->fops);
> > +	if (IS_ERR_OR_NULL(wilc_dir)) {
> > +		pr_err("Error creating debugfs\n");
> > +		return -EFAULT;
> >  	}
> 
> Just check for NULL.  If someone builds without debugfs enabled in their
> .config, that's their choice.  No need to print a warning.
> 

Reading it again, I'm not sure my email was clear...  Just do this:

	wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
	if (!wilc_dir)) {
		pr_err("Error creating debugfs/wilc_wifi/\n");
		return;
	}

If debugfs_create_dir() returns an error pointer it means all the other
debugfs functions are also just no-op stub functions.  Passing an error
pointer to them is harmless.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux