mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Baluta <daniel.baluta@oss.nxp.com>
To: "Frank Li" <Frank.Li@nxp.com>, "Peter Rosin" <peda@axentia.se>,
	"Linus Walleij" <linusw@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Rafał Miłecki" <rafal@milecki.pl>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/5] pinctrl: add generic board-level pinctrl driver using mux framework
Date: Fri, 20 Feb 2026 10:50:41 +0200	[thread overview]
Message-ID: <4d41eb9f-037e-4751-b878-202f7d613001@oss.nxp.com> (raw)
In-Reply-To: <20260219-pinctrl-mux-v1-3-678d21637788@nxp.com>

Hi Frank,

Few comments inline:


> --- /dev/null
> +++ b/drivers/pinctrl/pinctrl-generic-mux.c
> @@ -0,0 +1,222 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Generic Pin Control Driver for Board-Level Mux Chips
> + * Copyright (C) 2026
>
Copyright 2026 NXP

<snip>

> +struct mux_pin_function {
> +	struct mux_state *mux_state;
> +};
> +
> +struct mux_pinctrl {
> +	struct device *dev;
> +	struct pinctrl_dev *pctl;
> +
> +	/* mutex protecting the lists */

what lists? 


> +static int
> +mux_pinmux_dt_node_to_map(struct pinctrl_dev *pctldev,
> +			  struct device_node *np_config,
> +			  struct pinctrl_map **map, unsigned int *num_maps)
> +{
> +	struct mux_pinctrl *mpctl = pinctrl_dev_get_drvdata(pctldev);
> +	struct mux_pin_function *function;
> +	struct device *dev = mpctl->dev;
> +	const char **pgnames;
> +	int selector;
> +	int group;
> +	int ret;
> +
> +	*map = devm_kcalloc(dev, 1, sizeof(**map), GFP_KERNEL);
> +	if (!map)
> +		return -ENOMEM;
>
if (!*map) ?

> +
> +	*num_maps = 0;
> +
> +	function = devm_kzalloc(dev, sizeof(*function), GFP_KERNEL);
> +	if (!function) {
> +		ret = -ENOMEM;
> +		goto err_func;
Do you really need this goto? Previously allocated memory is dev managed .
> +	}
> +
> +	pgnames = devm_kzalloc(dev, sizeof(*pgnames), GFP_KERNEL);
> +	if (!pgnames) {
> +		ret = -ENOMEM;
> +		goto err_pgnames;
>
Same here.

<snip>

> +err_mux_state_get:
> +	pinctrl_generic_remove_group(mpctl->pctl, group);
> +err_add_group:
> +	pinmux_generic_remove_function(mpctl->pctl, selector);
> +err_add_func:
> +	devm_kfree(dev, pgnames);
> +err_pgnames:
> +	devm_kfree(dev, function);
> +err_func:
> +	devm_kfree(dev, *map);
> +
> +	return ret;
> +}





  reply	other threads:[~2026-02-20  8:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 22:23 [PATCH 0/5] pinctrl: Add generic pinctrl for board-level mux chips Frank Li
2026-02-19 22:23 ` [PATCH 1/5] mux: add devm_mux_control_get_from_np() to get mux from child node Frank Li
2026-02-19 22:23 ` [PATCH 2/5] dt-bindings: pinctrl: Add generic pinctrl for board-level mux chips Frank Li
2026-02-23 18:42   ` Rob Herring
2026-02-19 22:23 ` [PATCH 3/5] pinctrl: add generic board-level pinctrl driver using mux framework Frank Li
2026-02-20  8:50   ` Daniel Baluta [this message]
2026-02-20 15:54     ` Frank Li
2026-02-20 23:38   ` Peter Rosin
2026-02-19 22:23 ` [PATCH 4/5] arm64: dts: imx8mp-evk: add board-level mux for CAN2 and MICFIL Frank Li
2026-02-20  8:53   ` Daniel Baluta
2026-02-19 22:23 ` [PATCH 5/5] arm64: dts: imx8mp-evk: add flexcan2 overlay file Frank Li
2026-02-19 23:12 ` [PATCH 0/5] pinctrl: Add generic pinctrl for board-level mux chips Linus Walleij

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=4d41eb9f-037e-4751-b878-202f7d613001@oss.nxp.com \
    --to=daniel.baluta@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=rafal@milecki.pl \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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

all inboxes | Powered by JetHome®