[PATCH 5/6] i2c: imx_lpi2c: Fix error detection
    Heiko Schocher 
    hs at nabladev.com
       
    Wed Oct 22 07:16:58 CEST 2025
    
    
  
Hello Andrew,
On 21.10.25 18:08, Andrew Goodbody wrote:
> Testing an unisgned ivariable to be <= 0 will only detect the
> case when it is 0. So correct this error test to a working version that
> will behave as expected.
> 
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
> ---
>   drivers/i2c/imx_lpi2c.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c
> index 4636da9f3015ec8854c471fe3041fb8560f70041..a309fd6f07ce0dad22ae49bb4414c6e331b29927 100644
> --- a/drivers/i2c/imx_lpi2c.c
> +++ b/drivers/i2c/imx_lpi2c.c
> @@ -304,7 +304,7 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed)
>   
>   	if (CONFIG_IS_ENABLED(CLK)) {
>   		clock_rate = clk_get_rate(&i2c_bus->per_clk);
> -		if (clock_rate <= 0) {
> +		if (!clock_rate || IS_ERR_VALUE(clock_rate)) {
>   			dev_err(bus, "Failed to get i2c clk: %d\n", clock_rate);
>   			return clock_rate;
>   		}
> 
Reviewed-by: Heiko Schocher <hs at nabladev.com>
Thanks!
bye,
Heiko
-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Geschäftsführer : Stefano Babic
    
    
More information about the U-Boot
mailing list