Re: [PATCH 05/29] regulator: use IS_ERR_OR_NULL() instead of open-coding

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

 



On Mon, 11 Jun 2012, Mark Brown wrote:

> On Mon, Jun 11, 2012 at 01:38:13PM +0200, Guennadi Liakhovetski wrote:
> > On Fri, 18 May 2012, Mark Brown wrote:
> 
> > > This is checking the value of regulator_get(), NULL is a perfectly valid
> > > regulator value to get passed back.
> 
> > Sorry, could you clarify, how it is valid? No, I'm not proposing to revive 
> > this patch, just curious, what exactly you meant by this. AFAICS NULL is 
> > never returned from regulator_get(). The value, that's returned by it is 
> > then directly dereferenced in other regulator API calls, for which you 
> > don't normally want a NULL. So, having a regulator pointer == NULL seems 
> > to be as valid to me as causing a BUG() is? :-)
> 
> The stubs return NULL and we could decide in future to use NULL for
> something else (though that seems unlikely).

Ah, sure, forgot about that, sorry. In fact, I was wondering, whether it's 
indeed a good idea to return success from functions like 
regulator_set_voltage() or regulator_get_voltage() when regulator is even 
not configured? Isn't it confusing for drivers to get a success from 
set_voltage(voltage > 0) and then get 0V back from get_voltage()?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux