git: 264aeb32e9ee - stable/13 - ads111x: initialize the lock earlier, before it's used

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Fri, 27 Jun 2025 07:42:59 UTC
The branch stable/13 has been updated by avg:

URL: https://cgit.FreeBSD.org/src/commit/?id=264aeb32e9ee72614d6132660c8cc993fc24ef0d

commit 264aeb32e9ee72614d6132660c8cc993fc24ef0d
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2025-03-30 19:47:50 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2025-06-27 07:40:02 +0000

    ads111x: initialize the lock earlier, before it's used
    
    The first use can be in ads111x_add_channels.
    
    (cherry picked from commit eda3a7ac755c5e02f92ff971db63d0a702963d66)
---
 sys/dev/iicbus/ads111x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/iicbus/ads111x.c b/sys/dev/iicbus/ads111x.c
index 2c2bbd822c26..f7cb581f533f 100644
--- a/sys/dev/iicbus/ads111x.c
+++ b/sys/dev/iicbus/ads111x.c
@@ -559,6 +559,8 @@ ads111x_attach(device_t dev)
 		return (err);
 	}
 
+	sx_init(&sc->lock, "ads111x");
+
 	/* Add the sysctl handler to set the chip configuration register.  */
 	ctx = device_get_sysctl_ctx(dev);
 	tree = device_get_sysctl_tree(dev);
@@ -575,8 +577,6 @@ ads111x_attach(device_t dev)
 	/* Set up channels based on metadata or default config. */
 	ads111x_add_channels(sc);
 
-	sx_init(&sc->lock, "ads111x");
-
 	return (0);
 }