public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] thunderbolt: Do not dereference fwnode in struct device
@ 2021-12-07 15:41 Andy Shevchenko
  2021-12-07 15:49 ` Andy Shevchenko
  2021-12-08 10:26 ` Mika Westerberg
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-07 15:41 UTC (permalink / raw)
  To: Mika Westerberg, Rajmohan Mani, linux-usb, linux-kernel
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, 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 <andriy.shevchenko@linux.intel.com>
---
 drivers/thunderbolt/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
index b67e72d5644b..861d0fafb1d9 100644
--- a/drivers/thunderbolt/acpi.c
+++ b/drivers/thunderbolt/acpi.c
@@ -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;
 
 	/*
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] thunderbolt: Do not dereference fwnode in struct device
  2021-12-07 15:41 [PATCH v1 1/1] thunderbolt: Do not dereference fwnode in struct device Andy Shevchenko
@ 2021-12-07 15:49 ` Andy Shevchenko
  2021-12-08 10:26 ` Mika Westerberg
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-07 15:49 UTC (permalink / raw)
  To: Mika Westerberg, Rajmohan Mani, linux-usb, linux-kernel
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat

On Tue, Dec 07, 2021 at 05:41:43PM +0200, Andy Shevchenko wrote:
> 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.

...

>  	/* 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.

>  		goto out_put;

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] thunderbolt: Do not dereference fwnode in struct device
  2021-12-07 15:41 [PATCH v1 1/1] thunderbolt: Do not dereference fwnode in struct device Andy Shevchenko
  2021-12-07 15:49 ` Andy Shevchenko
@ 2021-12-08 10:26 ` Mika Westerberg
  1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2021-12-08 10:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rajmohan Mani, linux-usb, linux-kernel, Andreas Noever,
	Michael Jamet, Yehezkel Bernat

On Tue, Dec 07, 2021 at 05:41:43PM +0200, Andy Shevchenko wrote:
> 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 <andriy.shevchenko@linux.intel.com>

This version is fine. Applied to thunderbolt.git/next, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-08 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-07 15:41 [PATCH v1 1/1] thunderbolt: Do not dereference fwnode in struct device Andy Shevchenko
2021-12-07 15:49 ` Andy Shevchenko
2021-12-08 10:26 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox