[PATCH v2] usb: usbip: vudc: Fix WARN_ON() usage pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix WARN_ON() macro usage as suggested by Felipe.
Instead of using:
if (cond) {
   WARN_ON(1);
   do_stuff();
}

Use a better pattern with WARN_ON() placed in if condition:

if (WARN_ON(cond))
   do_stuff();

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
Changes since v1:
- Update commit message
---
 drivers/usb/usbip/vudc_dev.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index 43047f4..0523f29 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -312,10 +312,9 @@ static void vep_free_request(struct usb_ep *_ep, struct usb_request *_req)
 {
 	struct vrequest *req;
 
-	if (!_ep || !_req) {
-		WARN_ON(1);
+	if (WARN_ON(!_ep || !_req))
 		return;
-	}
+
 	req = to_vrequest(_req);
 	kfree(req);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux