diff mbox series

[1/2] mfd: omap-usb-tll: annotate struct usbtll_omap with __counted_by

Message ID 20240620-omap-usb-tll-counted_by-v1-1-77797834bb9a@gmail.com
State New
Headers show
Series mfd: omap-usb-tll: annotate struct usbtll_omap with __counted_by | expand

Commit Message

Javier Carrasco June 20, 2024, 9:22 p.m. UTC
Use the __counted_by compiler attribute for the "struct clk *ch_clk[]"
flexible array member to improve the results of array bound sanitizers.

The comments for the variables are no longer needed as it is now clear
what is what.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/mfd/omap-usb-tll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lee Jones June 26, 2024, 3:28 p.m. UTC | #1
On Thu, 20 Jun 2024 23:22:33 +0200, Javier Carrasco wrote:
> Use the __counted_by compiler attribute for the "struct clk *ch_clk[]"
> flexible array member to improve the results of array bound sanitizers.
> 
> The comments for the variables are no longer needed as it is now clear
> what is what.
> 
> 
> [...]

Applied, thanks!

[1/2] mfd: omap-usb-tll: annotate struct usbtll_omap with __counted_by
      commit: 621a62fdd279b06c23bc6c3073b8fe52b5dc356c

--
Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index b6303ddb013b..a091e5b0f21d 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -98,8 +98,8 @@ 
 
 struct usbtll_omap {
 	void __iomem	*base;
-	int		nch;		/* num. of channels */
-	struct clk	*ch_clk[];	/* must be the last member */
+	int		nch;
+	struct clk	*ch_clk[] __counted_by(nch);
 };
 
 /*-------------------------------------------------------------------------*/