public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Amit Ghadge <amitg.b14@gmail.com>
To: gregkh@linuxfoundation.org
Cc: accessrunner-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Amit Ghadge <amitg.b14@gmail.com>
Subject: [PATCH] usb: atm: cxacru: Clean up if function returned NULL on failure
Date: Tue, 13 Sep 2016 21:59:31 +0530	[thread overview]
Message-ID: <1473784171-7768-1-git-send-email-amitg.b14@gmail.com> (raw)

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

             reply	other threads:[~2016-09-13 16:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 16:29 Amit Ghadge [this message]
2016-09-27 10:44 ` [PATCH] usb: atm: cxacru: Clean up if function returned NULL on failure Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473784171-7768-1-git-send-email-amitg.b14@gmail.com \
    --to=amitg.b14@gmail.com \
    --cc=accessrunner-general@lists.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox