From: sashiko-bot@kernel.org
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: vkoul@kernel.org, linux-phy@lists.infradead.org,
olteanv@gmail.com, neil.armstrong@linaro.org
Subject: Re: [PATCH v4 2/5] phy: phy-can-transceiver: use device_get_match_data()
Date: Wed, 13 May 2026 21:26:11 +0000 [thread overview]
Message-ID: <20260513212611.EDC78C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260512130552.272476-3-andriy.shevchenko@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The error check for `device_get_match_data(dev)` is inverted, causing the driver probe to fail on success and triggering a NULL pointer dereference on failure.
--
commit f9915d9d74989682b2b7e20d67129e0dd4abdab9
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
phy: phy-can-transceiver: use device_get_match_data()
This commit transitions the driver to use the generic firmware node interface
for retrieving device match data instead of the OF-specific one. It also drops
the unneeded device node argument from devm_phy_create().
> diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c
> index 1808f903c0570..5cfd097352048 100644
> --- a/drivers/phy/phy-can-transceiver.c
> +++ b/drivers/phy/phy-can-transceiver.c
[ ... ]
> @@ -152,7 +152,6 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
> struct can_transceiver_phy *can_transceiver_phy;
> struct can_transceiver_priv *priv;
> const struct can_transceiver_data *drvdata;
> - const struct of_device_id *match;
> struct phy *phy;
> struct gpio_desc *silent_gpio;
> struct gpio_desc *standby_gpio;
> @@ -161,11 +160,10 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
> u32 max_bitrate = 0;
> int err, i, num_ch = 1;
>
> - match = of_match_node(can_transceiver_phy_ids, pdev->dev.of_node);
> - if (!match || !match->data)
> + drvdata = device_get_match_data(dev);
> + if (drvdata)
> return -ENODEV;
Does this invert the error check?
When device_get_match_data() successfully returns valid match data, it looks
like this condition will evaluate to true and erroneously abort the probe with
-ENODEV.
>
> - drvdata = match->data;
> if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH)
> num_ch = 2;
Conversely, if device_get_match_data() fails and returns NULL, won't the
probe continue and cause a NULL pointer dereference when evaluating
drvdata->flags here?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260512130552.272476-1-andriy.shevchenko@linux.intel.com?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-05-13 21:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 13:01 [PATCH v4 0/5] phy: phy-can-transceiver: Ad-hoc cleanups and refactoring Andy Shevchenko
2026-05-12 13:01 ` Andy Shevchenko
2026-05-12 13:01 ` [PATCH v4 1/5] phy: phy-can-transceiver: Check driver match and driver data against NULL Andy Shevchenko
2026-05-12 13:01 ` Andy Shevchenko
2026-05-12 13:01 ` [PATCH v4 2/5] phy: phy-can-transceiver: use device_get_match_data() Andy Shevchenko
2026-05-12 13:01 ` Andy Shevchenko
2026-05-13 21:26 ` sashiko-bot [this message]
2026-05-13 21:51 ` Andy Shevchenko
2026-05-12 13:01 ` [PATCH v4 3/5] phy: phy-can-transceiver: Move OF ID table closer to their user Andy Shevchenko
2026-05-12 13:01 ` Andy Shevchenko
2026-05-13 21:31 ` sashiko-bot
2026-05-12 13:01 ` [PATCH v4 4/5] phy: phy-can-transceiver: Don't check for specific errors when parsing properties Andy Shevchenko
2026-05-12 13:01 ` Andy Shevchenko
2026-05-13 21:38 ` sashiko-bot
2026-05-12 13:01 ` [PATCH v4 5/5] phy: phy-can-transceiver: Drop unused include Andy Shevchenko
2026-05-12 13:01 ` Andy Shevchenko
2026-05-13 21:44 ` sashiko-bot
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=20260513212611.EDC78C19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.