git: eda3a7ac755c - main - ads111x: initialize the lock earlier, before it's used

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Mon, 19 May 2025 09:15:55 UTC
The branch main has been updated by avg:

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

commit eda3a7ac755c5e02f92ff971db63d0a702963d66
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2025-03-30 19:47:50 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2025-05-19 09:15:03 +0000

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

diff --git a/sys/dev/iicbus/adc/ads111x.c b/sys/dev/iicbus/adc/ads111x.c
index dd223f69bb5f..21924627cc68 100644
--- a/sys/dev/iicbus/adc/ads111x.c
+++ b/sys/dev/iicbus/adc/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);
 }