[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Me20whtwS--+Zy2NLDGKH+wvxVtXFGMXj+E-ANun2U=qA@mail.gmail.com>
Date: Tue, 16 Nov 2021 10:12:30 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Jianqun Xu <jay.xu@...k-chips.com>,
Linus Walleij <linus.walleij@...aro.org>,
Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@...inx.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
"open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>,
Bamvor Jian Zhang <bamv2005@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Gregory Clement <gregory.clement@...tlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Heiko Stuebner <heiko@...ech.de>,
Patrice Chotard <patrice.chotard@...s.st.com>,
Michal Simek <michal.simek@...inx.com>,
Andy Shevchenko <andy@...nel.org>
Subject: Re: [PATCH v1 19/19] gpio: mockup: Switch to use kasprintf_strarray()
On Fri, Nov 5, 2021 at 1:43 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> Since we have a generic helper, switch the module to use it.
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> drivers/gpio/gpio-mockup.c | 23 +----------------------
> 1 file changed, 1 insertion(+), 22 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index d26bff29157b..8943cea92764 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -491,27 +491,6 @@ static void gpio_mockup_unregister_pdevs(void)
> }
> }
>
> -static __init char **gpio_mockup_make_line_names(const char *label,
> - unsigned int num_lines)
> -{
> - unsigned int i;
> - char **names;
> -
> - names = kcalloc(num_lines + 1, sizeof(char *), GFP_KERNEL);
> - if (!names)
> - return NULL;
> -
> - for (i = 0; i < num_lines; i++) {
> - names[i] = kasprintf(GFP_KERNEL, "%s-%u", label, i);
> - if (!names[i]) {
> - kfree_strarray(names, i);
> - return NULL;
> - }
> - }
> -
> - return names;
> -}
> -
> static int __init gpio_mockup_register_chip(int idx)
> {
> struct property_entry properties[GPIO_MOCKUP_MAX_PROP];
> @@ -538,7 +517,7 @@ static int __init gpio_mockup_register_chip(int idx)
> properties[prop++] = PROPERTY_ENTRY_U16("nr-gpios", ngpio);
>
> if (gpio_mockup_named_lines) {
> - line_names = gpio_mockup_make_line_names(chip_label, ngpio);
> + line_names = kasprintf_strarray(GFP_KERNEL, chip_label, ngpio);
> if (!line_names)
> return -ENOMEM;
>
> --
> 2.33.0
>
Acked-by: Bartosz Golaszewski <brgl@...ev.pl>
Feel free to take it with the rest of the series.
Bart
Powered by blists - more mailing lists