Re: [PATCH] i2c: i2c-mux-reg: wrong condition checked for of_address_to_resource return value

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

 



On Mon, Jun 27, 2016 at 11:21:48AM +0200, Lukasz Gemborowski wrote:
> of_address_to_resource return 0 on successful call but
> devm_ioremap_resource is called only if it returns non-zero value
> 
> Signed-off-by: Lukasz Gemborowski <lukasz.gemborowski@xxxxxxxxx>
> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
> ---
>  drivers/i2c/muxes/i2c-mux-reg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
> index 26e7c51..012a7ab 100644
> --- a/drivers/i2c/muxes/i2c-mux-reg.c
> +++ b/drivers/i2c/muxes/i2c-mux-reg.c
> @@ -145,7 +145,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
>  		mux->data.idle_in_use = true;
>  
>  	/* map address from "reg" if exists */
> -	if (of_address_to_resource(np, 0, &res)) {
> +	if (!of_address_to_resource(np, 0, &res)) {

Minor nit: I prefer '== 0' in those cases to prevent the misleading
reading of "if not of_address_to_resource...". '== 0' can be easier read
as 'is OK'.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux