[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <TY1PR01MB176930707EE4A5F730F1BF99F5DB0@TY1PR01MB1769.jpnprd01.prod.outlook.com>
Date: Thu, 22 Nov 2018 14:36:59 +0000
From: Phil Edworthy <phil.edworthy@...esas.com>
To: Simon Horman <horms@...ge.net.au>
CC: Geert Uytterhoeven <geert@...ux-m68k.org>,
Jacopo Mondi <jacopo@...ndi.org>,
Linus Walleij <linus.walleij@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>
Subject: RE: [PATCH] pinctrl: rzn1: Fix check for used MDIO bus
Hi Simon,
On 22 November 2018 14:09 Simon Horman wrote:
> On Mon, Nov 19, 2018 at 04:18:38PM +0000, Phil Edworthy wrote:
> > This fixes the check for unused mdio bus setting and the following
> > static checker warning:
> > drivers/pinctrl/pinctrl-rzn1.c:198 rzn1_pinctrl_mdio_select()
> > warn: always true condition '(ipctl->mdio_func[mdio] >= 0) => (0-u32max
> >= 0)'
> >
> > It also fixes the return var when calling of_get_child_count()
> >
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Signed-off-by: Phil Edworthy <phil.edworthy@...esas.com>
> > ---
> > v2:
> > - Don't rely on rely on the implicit typecast from -1 to uint
> > ---
> > drivers/pinctrl/pinctrl-rzn1.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-rzn1.c
> > b/drivers/pinctrl/pinctrl-rzn1.c index 57886dcff53d..cc0e5aa9128a
> > 100644
> > --- a/drivers/pinctrl/pinctrl-rzn1.c
> > +++ b/drivers/pinctrl/pinctrl-rzn1.c
> > @@ -112,7 +112,7 @@ struct rzn1_pinctrl {
> > struct rzn1_pinctrl_regs __iomem *lev2;
> > u32 lev1_protect_phys;
> > u32 lev2_protect_phys;
> > - u32 mdio_func[2];
> > + int mdio_func[2];
>
> Hi Phil,
>
> rzn1_pinctrl_mdio_select() assigns values of type u32 to elements of
> mdio_func. Perhaps that warrants cleaning up too?
The source of the 'u32 func' arg is ultimately u32 values read from DT.
The code already ensures that these cannot be bigger than 7, so is fine
I think.
Thanks
Phil
> > struct rzn1_pin_group *groups;
> > unsigned int ngroups;
> > @@ -810,8 +810,8 @@ static int rzn1_pinctrl_probe_dt(struct
> platform_device *pdev,
> > struct device_node *np = pdev->dev.of_node;
> > struct device_node *child;
> > unsigned int maxgroups = 0;
> > - unsigned int nfuncs = 0;
> > unsigned int i = 0;
> > + int nfuncs = 0;
> > int ret;
> >
> > nfuncs = of_get_child_count(np);
> > --
> > 2.17.1
> >
Powered by blists - more mailing lists