Skip to content

Commit ac9762a

Browse files
willdeacongregkh
authored andcommitted
misc: open-dice: Fix spurious lockdep warning
When probing the open-dice driver with PROVE_LOCKING=y, lockdep complains that the mutex in 'drvdata->lock' has a non-static key: | INFO: trying to register non-static key. | The code is fine but needs lockdep annotation, or maybe | you didn't initialize this object before use? | turning off the locking correctness validator. Fix the problem by initialising the mutex memory with mutex_init() instead of __MUTEX_INITIALIZER(). Cc: Arnd Bergmann <arnd@arndb.de> Cc: David Brazdil <dbrazdil@google.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20240126152410.10148-1-will@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a4e61de commit ac9762a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/misc/open-dice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ static int __init open_dice_probe(struct platform_device *pdev)
140140
return -ENOMEM;
141141

142142
*drvdata = (struct open_dice_drvdata){
143-
.lock = __MUTEX_INITIALIZER(drvdata->lock),
144143
.rmem = rmem,
145144
.misc = (struct miscdevice){
146145
.parent = dev,
@@ -150,6 +149,7 @@ static int __init open_dice_probe(struct platform_device *pdev)
150149
.mode = 0600,
151150
},
152151
};
152+
mutex_init(&drvdata->lock);
153153

154154
/* Index overflow check not needed, misc_register() will fail. */
155155
snprintf(drvdata->name, sizeof(drvdata->name), DRIVER_NAME"%u", dev_idx++);

0 commit comments

Comments
 (0)