public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: atm: cxacru: Clean up if function returned NULL on failure
@ 2016-09-13 16:29 Amit Ghadge
  2016-09-27 10:44 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Amit Ghadge @ 2016-09-13 16:29 UTC (permalink / raw)
  To: gregkh; +Cc: accessrunner-general, linux-kernel, Amit Ghadge

Some functions return NULL on failure, used !x instead of x==NULL.

Signed-off-by: Amit Ghadge <amitg.b14@gmail.com>
---
 drivers/usb/atm/cxacru.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 0a866e9..95a4737 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -228,7 +228,7 @@ static ssize_t cxacru_sysfs_show_##_name(struct device *dev, \
 	struct cxacru_data *instance = to_usbatm_driver_data(\
 		to_usb_interface(dev)); \
 \
-	if (instance == NULL) \
+	if (!instance) \
 		return -ENODEV; \
 \
 	return cxacru_sysfs_showattr_##_type(instance->card_info[_value], buf); \
@@ -280,7 +280,7 @@ static ssize_t cxacru_sysfs_showattr_LINK(u32 value, char *buf)
 {
 	static char *str[] = { NULL, "not connected", "connected", "lost" };
 
-	if (unlikely(value >= ARRAY_SIZE(str) || str[value] == NULL))
+	if (unlikely(value >= ARRAY_SIZE(str) || !str[value]))
 		return snprintf(buf, PAGE_SIZE, "%u\n", value);
 	return snprintf(buf, PAGE_SIZE, "%s\n", str[value]);
 }
@@ -323,7 +323,7 @@ static ssize_t cxacru_sysfs_show_mac_address(struct device *dev,
 	struct cxacru_data *instance = to_usbatm_driver_data(
 			to_usb_interface(dev));
 
-	if (instance == NULL || instance->usbatm->atm_dev == NULL)
+	if (!instance || !instance->usbatm->atm_dev)
 		return -ENODEV;
 
 	return snprintf(buf, PAGE_SIZE, "%pM\n",
@@ -338,7 +338,7 @@ static ssize_t cxacru_sysfs_show_adsl_state(struct device *dev,
 			to_usb_interface(dev));
 	u32 value;
 
-	if (instance == NULL)
+	if (!instance)
 		return -ENODEV;
 
 	value = instance->card_info[CXINF_LINE_STARTABLE];
@@ -365,7 +365,7 @@ static ssize_t cxacru_sysfs_store_adsl_state(struct device *dev,
 		return -EINVAL;
 	ret = 0;
 
-	if (instance == NULL)
+	if (!instance)
 		return -ENODEV;
 
 	if (mutex_lock_interruptible(&instance->adsl_state_serialize))
@@ -461,7 +461,7 @@ static ssize_t cxacru_sysfs_store_adsl_config(struct device *dev,
 	if (!capable(CAP_NET_ADMIN))
 		return -EACCES;
 
-	if (instance == NULL)
+	if (!instance)
 		return -ENODEV;
 
 	pos = 0;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: atm: cxacru: Clean up if function returned NULL on failure
  2016-09-13 16:29 [PATCH] usb: atm: cxacru: Clean up if function returned NULL on failure Amit Ghadge
@ 2016-09-27 10:44 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-09-27 10:44 UTC (permalink / raw)
  To: Amit Ghadge; +Cc: accessrunner-general, linux-kernel

On Tue, Sep 13, 2016 at 09:59:31PM +0530, Amit Ghadge wrote:
> Some functions return NULL on failure, used !x instead of x==NULL.
> 
> Signed-off-by: Amit Ghadge <amitg.b14@gmail.com>
> ---
>  drivers/usb/atm/cxacru.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Always use scripts/get_maintainer.pl to determine who to send patches
to, including which mailing list (hint, not lkml for usb patches...)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-27 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13 16:29 [PATCH] usb: atm: cxacru: Clean up if function returned NULL on failure Amit Ghadge
2016-09-27 10:44 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox