From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Cc: Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
"linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 4/9] pinctrl: sunxi: Deal with configless pins
Date: Fri, 7 Oct 2016 11:02:53 +0200 [thread overview]
Message-ID: <20161007090253.GL4684@lukather> (raw)
In-Reply-To: <CAGb2v654vv3B-OhHPgdLjsEOf0zPP=Ky1_+o=8mf9dZHMFjR-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2120 bytes --]
Hi,
On Tue, Oct 04, 2016 at 10:28:18AM +0800, Chen-Yu Tsai wrote:
> > if (sunxi_pctrl_has_drive_prop(node)) {
> > int drive = sunxi_pctrl_parse_drive_prop(node);
> > - if (drive < 0)
> > + if (drive < 0) {
> > + ret = -EINVAL;
>
> Why not just pass the error code returned from the parse function?
Yep, I'll change that.
> > - (*map)[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
> > - (*map)[i].data.configs.group_or_pin = group;
> > - (*map)[i].data.configs.configs = pinconfig;
> > - (*map)[i].data.configs.num_configs = configlen;
> > -
> > - i++;
> > + if (pinconfig) {
> > + (*map)[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
> > + (*map)[i].data.configs.group_or_pin = group;
> > + (*map)[i].data.configs.configs = pinconfig;
> > + (*map)[i].data.configs.num_configs = configlen;
> > + i++;
> > + }
> > }
> >
> > - *num_maps = nmaps;
> > + *num_maps = i;
>
> Thought: should we do a krealloc to shrink the array?
Yep, I'll make an additional patch to fix that.
>
> >
> > return 0;
> >
> > @@ -342,8 +357,13 @@ static void sunxi_pctrl_dt_free_map(struct pinctrl_dev *pctldev,
> > struct pinctrl_map *map,
> > unsigned num_maps)
> > {
> > + unsigned long *pinconfig;
> > +
> > /* All the maps have the same pin config, free only the first one */
> > - kfree(map[0].data.configs.configs);
> > + pinconfig = map[0].data.configs.configs;
> > + if (pinconfig)
> > + kfree(pinconfig);
>
> Passing NULL to kfree is allowed. (It becomes a no-op.)
> So you could leave this function alone.
And I'll change that as well.
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-10-07 9:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 10:20 [PATCH 0/9] pinctrl: sunxi: Generic bindings rework Maxime Ripard
2016-10-03 10:20 ` [PATCH 1/9] pinctrl: sunxi: Rework the pin config building code Maxime Ripard
2016-10-03 10:21 ` [PATCH 2/9] pinctrl: sunxi: Add bindings define Maxime Ripard
2016-10-04 1:57 ` Chen-Yu Tsai
2016-10-03 10:21 ` [PATCH 4/9] pinctrl: sunxi: Deal with configless pins Maxime Ripard
2016-10-04 2:28 ` Chen-Yu Tsai
[not found] ` <CAGb2v654vv3B-OhHPgdLjsEOf0zPP=Ky1_+o=8mf9dZHMFjR-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-07 9:02 ` Maxime Ripard [this message]
2016-10-03 10:21 ` [PATCH 5/9] pinctrl: sunxi: Support generic binding Maxime Ripard
2016-10-04 2:29 ` Chen-Yu Tsai
2016-10-03 10:21 ` [PATCH 7/9] ARM: sunxi: Remove useless allwinner,drive property Maxime Ripard
2016-10-04 2:34 ` Chen-Yu Tsai
2016-10-07 9:11 ` Maxime Ripard
[not found] ` <cover.26c6f76b361d146fb079d744251f020ef6d2db7d.1475489558.git-series.maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-03 10:21 ` [PATCH 3/9] pinctrl: sunxi: Handle bias disable Maxime Ripard
[not found] ` <f4de32e1b124b25c27e34efcadc1d332cb93ee59.1475489558.git-series.maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-04 2:14 ` Chen-Yu Tsai
2016-10-03 10:21 ` [PATCH 6/9] dt-bindings: pinctrl: Deprecate sunxi pinctrl bindings Maxime Ripard
[not found] ` <fad5a977d8ecdd43b37d7028b1bc32d8667b65a2.1475489558.git-series.maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-04 2:32 ` Chen-Yu Tsai
[not found] ` <CAGb2v67wk_DANTyzaxTM6Stgh-u2kZXn_kjb0vbWDYUd-DUxGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-07 9:04 ` Maxime Ripard
2016-10-03 10:21 ` [PATCH 8/9] ARM: sunxi: Remove useless allwinner,pull property Maxime Ripard
2016-10-04 2:35 ` Chen-Yu Tsai
2016-10-03 10:21 ` [PATCH 9/9] ARM: sunxi: Convert pinctrl nodes to generic bindings Maxime Ripard
2016-10-04 2:37 ` Chen-Yu Tsai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161007090253.GL4684@lukather \
--to=maxime.ripard-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wens-jdAy2FN1RRM@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).