From: Simon Horman <horms@kernel.org>
To: "Jan Petrous (OSS)" <jan.petrous@oss.nxp.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
dl-S32 <S32@nxp.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 4/6] net: stmmac: dwmac-s32cc: add basic NXP S32G/S32R glue
Date: Mon, 5 Aug 2024 18:00:02 +0100 [thread overview]
Message-ID: <20240805170002.GM2636630@kernel.org> (raw)
In-Reply-To: <AM9PR04MB85064D7EDF618DB5C34FB83BE2BD2@AM9PR04MB8506.eurprd04.prod.outlook.com>
On Sun, Aug 04, 2024 at 08:50:10PM +0000, Jan Petrous (OSS) wrote:
> NXP S32G2xx/S32G3xx and S32R45 are automotive grade SoCs
> that integrate one or two Synopsys DWMAC 5.10/5.20 IPs.
>
> The basic driver supports only RGMII interface.
>
> Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
...
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c
...
> +static int s32cc_gmac_init(struct platform_device *pdev, void *priv)
> +{
> + struct s32cc_priv_data *gmac = priv;
> + int ret;
> +
> + ret = clk_set_rate(gmac->tx_clk, GMAC_TX_RATE_125M);
> + if (!ret)
> + ret = clk_prepare_enable(gmac->tx_clk);
> +
> + if (ret) {
> + dev_err(&pdev->dev, "Can't set tx clock\n");
> + return ret;
> + }
> +
> + ret = clk_prepare_enable(gmac->rx_clk);
> + if (ret)
> + dev_dbg(&pdev->dev, "Can't set rx, clock source is disabled.\n");
> + else
> + gmac->rx_clk_enabled = true;
> +
> + ret = s32cc_gmac_write_phy_intf_select(gmac);
> + if (ret) {
> + dev_err(&pdev->dev, "Can't set PHY interface mode\n");
Should operations on tx_clk and rx_clk be unwound here?
Flagged by Smatch.
> + return ret;
> + }
> +
> + return 0;
> +}
...
> +static int s32cc_dwmac_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct plat_stmmacenet_data *plat;
> + struct s32cc_priv_data *gmac;
> + struct stmmac_resources res;
> + int ret;
Please consider arranging local variables in Networking code
in reverse xmas tree order - longest line to shortest.
Flagged by: https://github.com/ecree-solarflare/xmastree
> +
> + gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL);
> + if (!gmac)
> + return PTR_ERR(gmac);
This will return 0, perhaps return -ENOMEM ?
Flagged by Smatch.
...
next prev parent reply other threads:[~2024-08-05 17:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-04 20:50 [PATCH 4/6] net: stmmac: dwmac-s32cc: add basic NXP S32G/S32R glue Jan Petrous (OSS)
2024-08-05 15:08 ` Russell King (Oracle)
2024-08-18 19:35 ` Jan Petrous (OSS)
2024-08-05 17:00 ` Simon Horman [this message]
2024-08-18 19:39 ` Jan Petrous (OSS)
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=20240805170002.GM2636630@kernel.org \
--to=horms@kernel.org \
--cc=S32@nxp.com \
--cc=alexandre.torgue@foss.st.com \
--cc=claudiu.manoil@nxp.com \
--cc=jan.petrous@oss.nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.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).