[PATCH] pinctrl: mediatek: move bit assignment

Matthias Brugger matthias.bgg at gmail.com
Wed Jun 2 05:34:27 PDT 2021


Hi Linus,

On 28/05/2021 11:19, Linus Walleij wrote:
> The bit needs offset to be defined which happens some lines
> below. Looks like a bug. The kernel test robot complains:
> 
> drivers/pinctrl/mediatek/pinctrl-mtk-common.c:137:12:
> warning: variable 'offset' is uninitialized when used here [-Wuninitialized]
>            bit = BIT(offset & pctl->devdata->mode_mask);
>                      ^~~~~~
> 
> Fix it up by reverting to what was done before.
> 
> Cc: Fabien Parent <fparent at baylibre.com>
> Cc: Sean Wang <sean.wang at kernel.org>
> Cc: Matthias Brugger <matthias.bgg at gmail.com>
> Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> Cc: linux-mediatek at lists.infradead.org
> Fixes: 9f940d8ecf92 ("pinctrl: mediatek: don't hardcode mode encoding in common code")
> Reported-by: kernel test robot <lkp at intel.com>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 9fe91e11a877..525b1aa7f7a6 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -134,7 +134,7 @@ static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin,
>  			pin, pctl->devdata->port_align, value, arg);
>  	}
>  
> -	
> +	bit = BIT(pin & 0xf);

I see this is already applied to linux-next, but I think the correct fix is to move
bit = BIT(offset & pctl->devdata->mode_mask);
just before calling regmap_write(...)

I can provide a patch for that, if you want. Just let me know if I should base
it against linux-next or if you will drop the fix proposed by you?

Regards,
Matthias

>  
>  	if (arg == PIN_CONFIG_INPUT_ENABLE)
>  		offset = pctl->devdata->ies_offset;
> 



More information about the Linux-mediatek mailing list