[PATCH v2 18/22] phy: apple: Add Apple Type-C PHY
Nathan Chancellor
nathan at kernel.org
Tue Sep 9 15:25:44 PDT 2025
On Mon, Sep 08, 2025 at 08:12:59PM +0200, Janne Grunau wrote:
> On Sat, Sep 06, 2025 at 03:43:31PM +0000, Sven Peter wrote:
> > diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..9213485234873fcaafeb1d1d9de3ddf07767d552
> > --- /dev/null
> > +++ b/drivers/phy/apple/atc.c
> > @@ -0,0 +1,2214 @@
>
> [...]
>
> > +static int atcphy_load_tunables(struct apple_atcphy *atcphy)
> > +{
> > + int ret;
> > + struct {
> > + const char *dt_name;
> > + struct apple_tunable **tunable;
> > + } tunables[] = {
> > + { "apple,tunable-fuses", &atcphy->tunables.fuses },
> > + { "apple,tunable-axi2af", &atcphy->tunables.axi2af },
> > + { "apple,tunable-common", &atcphy->tunables.common },
> > + { "apple,tunable-lane0-usb", &atcphy->tunables.lane_usb3[0] },
> > + { "apple,tunable-lane1-usb", &atcphy->tunables.lane_usb3[1] },
> > + { "apple,tunable-lane0-cio", &atcphy->tunables.lane_usb4[0] },
> > + { "apple,tunable-lane1-cio", &atcphy->tunables.lane_usb4[1] },
> > + { "apple,tunable-lane0-dp", &atcphy->tunables.lane_displayport[0] },
> > + { "apple,tunable-lane1-dp", &atcphy->tunables.lane_displayport[1] },
> > + };
> > +
> > + for (int i = 0; i < ARRAY_SIZE(tunables); i++) {
> > + *tunables[i].tunable =
> > + devm_apple_tunable_parse(atcphy->dev, atcphy->np, tunables[i].dt_name);
> > + if (IS_ERR(tunables[i].tunable)) {
> > + dev_err(atcphy->dev, "Failed to read tunable %s: %ld\n",
> > + tunables[i].dt_name, PTR_ERR(tunables[i].tunable));
> > + return ret;
>
> ret is unitialized here, could be `return PTR_ERR(tunables[i].tunable);`
> instead
This could also use '%pe' to symbolically print the error name instead
of the integer value.
dev_err(atcphy->dev, "Failed to read tunable %s: %pe\n",
tunables[i].dt_name, tunables[i].tunable);
Cheers,
Nathan
More information about the linux-phy
mailing list