Re: [PATCH 10/14] staging: clocking-wizard: Support clk_round_rate

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

 



On Tue, May 15, 2018 at 10:52:58AM +0300, Dan Carpenter wrote:
> On Mon, May 07, 2018 at 11:20:36AM +1000, James Kelly wrote:
> > @@ -463,6 +549,16 @@ static int clk_wzrd_debug_init(struct clk_hw *hw, struct dentry *dentry)
> >  	struct dentry *d;
> >  	struct clk_wzrd_clk_data *cwc = to_clk_wzrd_clk_data(hw);
> >  
> > +	d = debugfs_create_u16("clk_ratio_min", 0444, dentry,
> > +			       (u16 *)&cwc->ratio_limit->min);
> > +	if (IS_ERR(d))
> > +		return PTR_ERR(d);
> > +
> > +	d = debugfs_create_u16("clk_ratio_max", 0444, dentry,
> > +			       (u16 *)&cwc->ratio_limit->max);
> > +	if (IS_ERR(d))
> > +		return PTR_ERR(d);
> 
> 
> All these debugfs stuff should be tests for NULL.
> 
>  *
>  * If debugfs is not enabled in the kernel, the value -%ENODEV will be
>  * returned.  It is not wise to check for this value, but rather, check for
>  * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
>  * code.

No, you should not check for anything, debugfs calls can work just fine
by ignoring the return value.  You should not care what debugfs does, or
does not do, when you call it.

I should update the documentation a bit better, but no one seems to even
read it anyway :(

thanks,

greg k-h
_______________________________________________
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