From: Jerome Brunet <jbrunet@baylibre.com>
To: sashiko-reviews@lists.linux.dev
Cc: robh@kernel.org, conor+dt@kernel.org,
linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v3 2/5] net: stmmac: sun55i: Add per-compatible match data
Date: Fri, 25 Sep 2026 10:30:00 +0200 [thread overview]
Message-ID: <1jpky191iv.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <20260924204842.9457B1F00893@smtp.kernel.org>
On jeu. 24 sept. 2026 at 20:48, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] net: stmmac: sun55i: sun55i_gmac pointer is lost after probe
> --
>
> commit 96a080b2a3499368db013319e188847cee61183d
> Author: Jerome Brunet <jbrunet@baylibre.com>
>
> net: stmmac: sun55i: Add per-compatible match data
>
> The A733 GMAC210 glue registers are in a dedicated MMIO region of the
> controller rather than in a syscon. This commit adds per-compatible match
> data holding the glue resource init callback, the stmmac flags, and the
> glue register offset.
>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c
>> index 862df173d963f..c4df532850074 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c
>
> [ ... ]
>
>> @@ -107,22 +128,34 @@ static int sun55i_gmac200_probe(struct platform_device *pdev)
>> struct plat_stmmacenet_data *plat_dat;
>> struct stmmac_resources stmmac_res;
>> struct device *dev = &pdev->dev;
>> + struct sun55i_gmac *gmac;
>> struct clk *clk;
>> int ret;
>>
>> + gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
>> + if (!gmac)
>> + return -ENOMEM;
>> +
>
> [ ... ]
>
>> @@ -138,8 +171,15 @@ static int sun55i_gmac200_probe(struct platform_device *pdev)
>> if (ret)
>> return dev_err_probe(dev, ret, "Failed to get or enable PHY supply\n");
>>
>> return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
>> }
>
> [Severity: Low]
> Does this code intentionally discard the gmac pointer after probe?
>
> The sun55i_gmac structure is dynamically allocated via devm_kzalloc(), but
> it does not appear to be saved (for example, to plat_dat->bsp_priv) before
> sun55i_gmac200_probe() returns.
>
> If the structure is only intended for use during initialization, could it be
> allocated on the stack to prevent an unnecessary heap allocation that
> persists for the lifetime of the device? Alternatively, if it is meant to
> hold state (like the regmap) for future callbacks, does the pointer need to
> be saved here?
Yeah, At one point I was thinking of setting stmmac bsp_priv to prepare
for a possible suspend/resume support later on. Eventually it will be necessary.
I could do the stack option or keep it that way and set bsp_priv.
I don't mind one way or they other. If someone as a preference, please
let me know.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260923-allwinner-a733-gmac-support-v3-0-15735155a789@baylibre.com?part=2
--
Jerome
next prev parent reply other threads:[~2026-09-25 8:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 20:47 [PATCH net-next v3 0/5] net: stmmac: Add support for Allwinner A733 GMAC210 Jerome Brunet
2026-09-23 20:47 ` [PATCH net-next v3 1/5] dt-bindings: net: sun8i-emac: Add A733 GMAC210 compatible Jerome Brunet
2026-09-23 20:47 ` [PATCH net-next v3 2/5] net: stmmac: sun55i: Add per-compatible match data Jerome Brunet
2026-09-24 20:48 ` sashiko-bot
2026-09-25 8:30 ` Jerome Brunet [this message]
2026-09-23 20:47 ` [PATCH net-next v3 3/5] net: stmmac: sun55i: Make the delay step configurable Jerome Brunet
2026-09-24 2:30 ` Andrew Lunn
2026-09-24 8:53 ` Jerome Brunet
2026-09-24 12:55 ` Andrew Lunn
2026-09-23 20:47 ` [PATCH net-next v3 4/5] net: stmmac: sun55i: Support TX delay extension bits Jerome Brunet
2026-09-23 20:47 ` [PATCH net-next v3 5/5] net: stmmac: sun55i: Add support for Allwinner A733 GMAC210 Jerome Brunet
2026-09-23 22:15 ` [PATCH net-next v3 0/5] net: stmmac: " Andrew Lunn
2026-09-23 22:19 ` Andrew Lunn
2026-09-24 8:40 ` Jerome Brunet
2026-09-24 12:54 ` Andrew Lunn
2026-09-24 15:27 ` Jerome Brunet
2026-09-24 16:02 ` Andrew Lunn
2026-09-25 8:26 ` Jerome Brunet
2026-09-25 19:45 ` Andrew Lunn
2026-09-29 15:06 ` Jerome Brunet
2026-09-29 16:10 ` Andrew Lunn
2026-09-29 17:15 ` Jerome Brunet
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=1jpky191iv.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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