From: Arnd Bergmann Date: Wed, 10 Jan 2018 20:51:05 +0000 (+0100) Subject: CIFS: SMBD: work around gcc -Wmaybe-uninitialized warning X-Git-Tag: v5.15~9580^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e36c048a9bd853b64c2b32a2ed90be2eff9bbd62;p=platform%2Fkernel%2Flinux-starfive.git CIFS: SMBD: work around gcc -Wmaybe-uninitialized warning GCC versions from 4.9 to 6.3 produce a false-positive warning when dealing with a conditional spin_lock_irqsave(): fs/cifs/smbdirect.c: In function 'smbd_recv_buf': include/linux/spinlock.h:260:3: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] This function calls some sleeping interfaces, so it is clear that it does not get called with interrupts disabled and there is no need to save the irq state before taking the spinlock. This lets us remove the variable, which makes the function slightly more efficient and avoids the warning. A further cleanup could do the same change for other functions in this file, but I did not want to take this too far for now. Fixes: ac69f66e54ca ("CIFS: SMBD: Implement function to receive data via RDMA receive") Signed-off-by: Arnd Bergmann Signed-off-by: Steve French --- diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index f527e22..f9234ed 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1862,7 +1862,6 @@ int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) int to_copy, to_read, data_read, offset; u32 data_length, remaining_data_length, data_offset; int rc; - unsigned long flags; again: if (info->transport_status != SMBD_CONNECTED) { @@ -1935,15 +1934,13 @@ again: * end of the queue */ if (!queue_length) - spin_lock_irqsave( - &info->reassembly_queue_lock, - flags); + spin_lock_irq( + &info->reassembly_queue_lock); list_del(&response->list); queue_removed++; if (!queue_length) - spin_unlock_irqrestore( - &info->reassembly_queue_lock, - flags); + spin_unlock_irq( + &info->reassembly_queue_lock); info->count_reassembly_queue--; info->count_dequeue_reassembly_queue++; @@ -1963,10 +1960,10 @@ again: to_read, data_read, offset); } - spin_lock_irqsave(&info->reassembly_queue_lock, flags); + spin_lock_irq(&info->reassembly_queue_lock); info->reassembly_data_length -= data_read; info->reassembly_queue_length -= queue_removed; - spin_unlock_irqrestore(&info->reassembly_queue_lock, flags); + spin_unlock_irq(&info->reassembly_queue_lock); info->first_entry_offset = offset; log_read(INFO, "returning to thread data_read=%d "