Trivial sparse acquire/release annotations
Subsystems (3)
cover Trivial sparse acquire/release annotations
Hi,
So, I was looking at sparse this lazy Saturday afternoon. Thought I might as well clean up a few obvious warnings while I'm there.
Thanks.
Ramkumar Ramachandra (3):
nfs: add lock annotations to squelch sparse warnings
apic: add lock annotations to squelch sparse warnings
irq: add lock annotation to squelch a sparse warning
arch/x86/kernel/apic/io_apic.c | 2 ++ fs/nfs/client.c | 4 ++++ kernel/irq/irqdesc.c | 1 + 3 files changed, 7 insertions(+)
Signature · 1 line
1.8.3.2.733.gf8abaeb
PATCH 1/3 nfs: add lock annotations to squelch sparse warnings
sparse, being a static analyzer, emits the following warnings:
context imbalance in 'nfs_server_list_start' - wrong count at exit context imbalance in 'nfs_server_list_start' - unexpected unlock context imbalance in 'nfs_volume_list_start' - wrong count at exit context imbalance in 'nfs_volume_list_start' - unexpected unlock
Help it by annotating the pairs of functions with __acquires and __releases.
--- fs/nfs/client.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/nfs/client.c +4 -0
@@ -1253,6 +1253,7 @@ static int nfs_server_list_open(struct inode *inode, struct file *file)* set up the iterator to start reading from the server list and return the first item */ static void *nfs_server_list_start (struct seq_file *m,loff_t *_pos) + __acquires(&nn->nfs_client_lock) {struct nfs_net *nn =net_generic (m->private, nfs_net_id);
@@ -1275,6 +1276,7 @@ static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos)* clean up after reading from the transports list */ static void nfs_server_list_stop (struct seq_file *p,void *v) + __releases(&nn->nfs_client_lock) {struct nfs_net *nn =net_generic (p->private, nfs_net_id);
@@ -1338,6 +1340,7 @@ static int nfs_volume_list_open(struct inode *inode, struct file *file)* set up the iterator to start reading from the volume list and return the first item */ static void *nfs_volume_list_start (struct seq_file *m,loff_t *_pos) + __acquires(&nn->nfs_client_lock) {struct nfs_net *nn =net_generic (m->private, nfs_net_id);
@@ -1360,6 +1363,7 @@ static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos)* clean up after reading from the transports list */ static void nfs_volume_list_stop (struct seq_file *p,void *v) + __releases(&nn->nfs_client_lock) {struct nfs_net *nn =net_generic (p->private, nfs_net_id);
Signature · 1 line
1.8.3.2.733.gf8abaeb
PATCH 2/3 apic: add lock annotations to squelch sparse warnings
In reply to Ramkumar Ramachandrasparse, being a static analyzer, emits the following warnings:
context imbalance in 'lock_vector_lock' - wrong count at exit context imbalance in 'unlock_vector_lock' - unexpected unlock
Help it by annotating the pair of functions with __acquires and __releases.
--- arch/x86/kernel/apic/io_apic.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/apic/io_apic.c +2 -0
@@ -1061,6 +1061,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,EXPORT_SYMBOL (IO_APIC_get_PCI_irq_vector);void lock_vector_lock (void ) + __acquires(&vector_lock) {/* Used to the online set of cpus does not change * during assign_irq_vector.
@@ -1069,6 +1070,7 @@ void lock_vector_lock(void) }void unlock_vector_lock (void ) + __releases(&vector_lock) {raw_spin_unlock (&vector_lock); }
Signature · 1 line
1.8.3.2.733.gf8abaeb
PATCH 3/3 irq: add lock annotation to squelch a sparse warning
In reply to Ramkumar Ramachandra__irq_put_desc_unlock() releases &desc->lock, but being a static analyzer, sparse emits a warning:
context imbalance in '__irq_put_desc_unlock' - unexpected unlock
Help it by annotating the function with a __release. Do not annotate its counterpart which acquires the lock, __irq_get_desc_lock(), because it does so conditionally.
--- kernel/irq/irqdesc.c | 1 + 1 file changed, 1 insertion(+)
kernel/irq/irqdesc.c +1 -0
@@ -449,6 +449,7 @@ __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus, }void __irq_put_desc_unlock (struct irq_desc *desc,unsigned long flags,bool bus) + __releases(&desc->lock) {raw_spin_unlock_irqrestore (&desc->lock, flags);if (bus)
Signature · 1 line
1.8.3.2.733.gf8abaeb
Quoted 4 lines · Ramkumar Ramachandra
Ramkumar Ramachandra (3):
nfs: add lock annotations to squelch sparse warnings
apic: add lock annotations to squelch sparse warnings
irq: add lock annotation to squelch a sparse warning
Ping. Can someone pick these up?