lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <AM9PR04MB850673CFC7542E1569A34FD5E2832@AM9PR04MB8506.eurprd04.prod.outlook.com>
Date: Sun, 18 Aug 2024 19:39:48 +0000
From: "Jan Petrous (OSS)" <jan.petrous@....nxp.com>
To: Simon Horman <horms@...nel.org>, "Jan Petrous (OSS)"
	<jan.petrous@....nxp.com>
CC: Maxime Coquelin <mcoquelin.stm32@...il.com>, Alexandre Torgue
	<alexandre.torgue@...s.st.com>, dl-S32 <S32@....com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-stm32@...md-mailman.stormreply.com"
	<linux-stm32@...md-mailman.stormreply.com>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>
Subject: RE: [PATCH 4/6] net: stmmac: dwmac-s32cc: add basic NXP S32G/S32R
 glue

> -----Original Message-----
> From: Simon Horman <horms@...nel.org>
> Sent: Monday, 5 August, 2024 19:00
> To: Jan Petrous (OSS) <jan.petrous@....nxp.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>; Alexandre Torgue
> <alexandre.torgue@...s.st.com>; dl-S32 <S32@....com>; linux-
> kernel@...r.kernel.org; linux-stm32@...md-mailman.stormreply.com; linux-
> arm-kernel@...ts.infradead.org; Claudiu Manoil <claudiu.manoil@....com>;
> netdev@...r.kernel.org
> Subject: Re: [PATCH 4/6] net: stmmac: dwmac-s32cc: add basic NXP
> S32G/S32R glue
> 
> 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@....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.

Yes, it shall be there. Added to v2.

> 
> > +		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
> 

Done for v2.

> > +
> > +	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.

Changed to -ENOMEM.

Thanks for review.
/Jan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ