thunderbolt: Do not dereference fwnode in struct device
Subsystems (2)
PATCH 1/1 thunderbolt: Do not dereference fwnode in struct device
In order to make the underneath API easier to change in the future, prevent users from dereferencing fwnode from struct device. Instead, use the specific dev_fwnode() API for that.
--- drivers/thunderbolt/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thunderbolt/acpi.c +1 -1
@@ -31,7 +31,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,return AE_OK ;/* It needs to reference this NHI */ -if (nhi->pdev->dev.fwnode != args.fwnode) +if (dev_fwnode (&nhi->pdev->dev) != args.fwnode) goto out_put;/*
Signature · 1 line
2.33.0
Quoted 3 lines · Andy Shevchenko
In order to make the underneath API easier to change in the future, prevent users from dereferencing fwnode from struct device. Instead, use the specific
dev_fwnode()API for that.
...
drivers/thunderbolt/acpi.c static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data, · line 34
Quoted 3 lines
drivers/thunderbolt/acpi.c +1
-1/* It needs to reference this NHI */ -if (nhi->pdev->dev.fwnode != args.fwnode) +if (dev_fwnode (&nhi->pdev->dev) != args.fwnode)
Alternatively:
if (!device_match_fwnode(&nhi->pdev->dev, args.fwnode))
Tell me. which one you prefer.
Quoted 1 line
goto
out_put;
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
In order to make the underneath API easier to change in the future, prevent users from dereferencing fwnode from struct device. Instead, use the specific
dev_fwnode()API for that.Signed-off-by Andy Shevchenko <[email protected]>
This version is fine. Applied to thunderbolt.git/next, thanks!