Re: [PATCH 2/2] usb: gadget: udc: pxa25x: remove unnecessary NULL check

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

 



On Tue, Nov 25, 2014 at 08:35:00AM +0100, Robert Jarzmik wrote:
> Felipe Balbi <balbi@xxxxxx> writes:
> 
> > On Mon, Nov 24, 2014 at 10:45:03PM +0100, Robert Jarzmik wrote:
> >> Felipe Balbi <balbi@xxxxxx> writes:
> >> 
> >> > @@ -1136,8 +1136,7 @@ static const struct file_operations debug_fops = {
> >> >  	} while (0)
> >> >  #define remove_debug_files(dev) \
> >> >  	do { \
> >> > -		if (dev->debugfs_udc) \
> >> > -			debugfs_remove(dev->debugfs_udc); \
> >> > +		debugfs_remove(dev->debugfs_udc); \
> >> >  	} while (0)
> >> 
> >> Why this simpler form ?
> >> #define remove_debug_files(dev) debugfs_remove(dev->debugfs_udc)
> >
> > sure, I'll do that. Do I get a Review-by ?
> Of course.
> 
> Reviewed-by: Robert Jarzmik <robert.jarzmik@xxxxxxx>

here's updated patch:

8<-----------------------------------------------------------------

From 87b5956b2fbfe3b1591a2d512f22a9c0b31c0972 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <balbi@xxxxxx>
Date: Mon, 24 Nov 2014 08:40:01 -0600
Subject: [PATCH] usb: gadget: udc: pxa25x: remove unnecessary NULL check

debugfs_remove() is safe against NULL pointers, so
let's remove the unnecessary NULL check before
calling it.

Reviewed-by: Robert Jarzmik <robert.jarzmik@xxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index 8664b99..347a05b 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -1134,11 +1134,7 @@ static const struct file_operations debug_fops = {
 		dev->debugfs_udc = debugfs_create_file(dev->gadget.name, \
 			S_IRUGO, NULL, dev, &debug_fops); \
 	} while (0)
-#define remove_debug_files(dev) \
-	do { \
-		if (dev->debugfs_udc) \
-			debugfs_remove(dev->debugfs_udc); \
-	} while (0)
+#define remove_debug_files(dev) debugfs_remove(dev->debugfs_udc)
 
 #else	/* !CONFIG_USB_GADGET_DEBUG_FILES */
 
-- 
2.1.0.GIT


-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux