Skip to contentSkip to conversation

Drivers: hv: balloon: add a comment explaining fall through in hv_memory_notifier()

PATCH Superseded Vitaly Kuznetsov 2 participants 2 messages Jan 25, 2017 Hyper-V/Azure core and drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drivers: hv: balloon: add a comment explaining fall through in hv_memory_notifier()

Coverity scan gives a warning when there is fall through in a switch without a comment.

---
 drivers/hv/hv_balloon.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hv/hv_balloon.c +6 -0
index 14c3dc4..7e2479f 100644
@@ -587,6 +587,12 @@ static int hv_memory_notifier(struct notifier_block *nb, unsigned long val,
 		spin_lock_irqsave(&dm_device.ha_lock, flags);
 		dm_device.num_pages_onlined += mem->nr_pages;
 		spin_unlock_irqrestore(&dm_device.ha_lock, flags);
+		/*
+		 * Fall through - ol_waitevent needs to be completed to unblock
+		 * hv_mem_hot_add() allowing it to process next requests
+		 * regardless of the result of if we were able to online this
+		 * block.
+		 */
 	case MEM_CANCEL_ONLINE:
 		if (dm_device.ha_waiting) {
 			dm_device.ha_waiting = false;
Signature · 1 line
2.9.3
#1 lore raw

Simpe /* fallthrough */ is enough

-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, January 25, 2017 8:27 AM
To: [email protected]
Cc: [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Stephen Hemminger <[email protected]>
Subject: [PATCH] Drivers: hv: balloon: add a comment explaining fall through in hv_memory_notifier()

Coverity scan gives a warning when there is fall through in a switch without a comment.

---
 drivers/hv/hv_balloon.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hv/hv_balloon.c +6 -0
@@ -587,6 +587,12 @@ static int hv_memory_notifier(struct notifier_block *nb, unsigned long val,
 		spin_lock_irqsave(&dm_device.ha_lock, flags);
 		dm_device.num_pages_onlined += mem->nr_pages;
 		spin_unlock_irqrestore(&dm_device.ha_lock, flags);
+		/*
+		 * Fall through - ol_waitevent needs to be completed to unblock
+		 * hv_mem_hot_add() allowing it to process next requests
+		 * regardless of the result of if we were able to online this
+		 * block.
+		 */
 	case MEM_CANCEL_ONLINE:
 		if (dm_device.ha_waiting) {
 			dm_device.ha_waiting = false;

--
2.9.3