On Tue, Nov 10, 2020 at 01:34:05PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszew...@baylibre.com>
> 
> We can simplify the code in gpio-exar by using regmap. This allows us to
> drop the mutex (regmap provides its own locking) and we can also reuse
> regmap's bit operations instead of implementing our own update function.

...

> +     /*
> +      * We don't need to check the return values of mmio regmap operations 
> (unless
> +      * the regmap has a clock attached which is not the case here).
> +      */
> +     exar_gpio->regs = devm_regmap_init_mmio(dev, p, &exar_regmap_config);
> +     if (IS_ERR(exar_gpio->regs))
> +             return PTR_ERR(exar_gpio->regs);
>  
>       index = ida_alloc(&ida_index, GFP_KERNEL);
> -     if (index < 0) {
> -             ret = index;
> -             goto err_mutex_destroy;
> -     }
> +     if (index < 0)
> +             return index;

And below you effectively use p as regmap!
That's what renaming of variable regs -> regmap or map can easily reveal.

        exar_gpio->regs = p;


-- 
With Best Regards,
Andy Shevchenko


Reply via email to