Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1645796 > unrolled thread

[PATCH 0/4] ueagle-atm: Adjustments for eight function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-19 19:50 +0200
Last post2017-05-19 20:20 +0200
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] ueagle-atm: Adjustments for eight function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-19 19:50 +0200
    [PATCH 2/4] ueagle-atm: Improve a size determination in uea_bind() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-19 20:00 +0200
    [PATCH 4/4] ueagle-atm: Adjust three checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-19 20:00 +0200
    [PATCH 3/4] ueagle-atm: Delete unnecessary return statements in two  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-19 20:20 +0200

#1645796 — [PATCH 0/4] ueagle-atm: Adjustments for eight function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-19 19:50 +0200
Subject[PATCH 0/4] ueagle-atm: Adjustments for eight function implementations
Message-ID<tIUch-5rg-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 19 May 2017 19:41:23 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (4):
  Delete error messages for failed memory allocations in two functions
  Improve a size determination in uea_bind()
  Delete unnecessary return statements in two functions
  Adjust three checks for null pointers

 drivers/usb/atm/ueagle-atm.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

-- 
2.13.0

[toc] | [next] | [standalone]


#1645803 — [PATCH 2/4] ueagle-atm: Improve a size determination in uea_bind()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-19 20:00 +0200
Subject[PATCH 2/4] ueagle-atm: Improve a size determination in uea_bind()
Message-ID<tIUlY-5uX-23@gated-at.bofh.it>
In reply to#1645796
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 19 May 2017 19:09:28 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/usb/atm/ueagle-atm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 16fd87df69e1..9725e6f2f301 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2551,7 +2551,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
 			return ret;
 	}
 
-	sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL);
+	sc = kzalloc(sizeof(*sc), GFP_KERNEL);
 	if (!sc)
 		return -ENOMEM;
 
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1645804 — [PATCH 4/4] ueagle-atm: Adjust three checks for null pointers

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-19 20:00 +0200
Subject[PATCH 4/4] ueagle-atm: Adjust three checks for null pointers
Message-ID<tIUlY-5uX-19@gated-at.bofh.it>
In reply to#1645796
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 19 May 2017 19:29:08 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/usb/atm/ueagle-atm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 0ca4ff3e6683..5c9517bfb82c 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -955,7 +955,7 @@ static void uea_load_page_e1(struct work_struct *work)
 		sc->dsp_firm = NULL;
 	}
 
-	if (sc->dsp_firm == NULL && request_dsp(sc) < 0)
+	if (!sc->dsp_firm && request_dsp(sc) < 0)
 		return;
 
 	p = sc->dsp_firm->data;
@@ -1076,7 +1076,7 @@ static void uea_load_page_e4(struct work_struct *work)
 		sc->dsp_firm = NULL;
 	}
 
-	if (sc->dsp_firm == NULL && request_dsp(sc) < 0)
+	if (!sc->dsp_firm && request_dsp(sc) < 0)
 		return;
 
 	p = (struct l1_code *) sc->dsp_firm->data;
@@ -1596,7 +1596,7 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
 
 	kernel_param_lock(THIS_MODULE);
 	/* set proper name corresponding modem version and line type */
-	if (cmv_file[sc->modem_index] == NULL) {
+	if (!cmv_file[sc->modem_index]) {
 		if (UEA_CHIP_VERSION(sc) == ADI930)
 			file_arr[3] = '9';
 		else if (UEA_CHIP_VERSION(sc) == EAGLE_IV)
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1645825 — [PATCH 3/4] ueagle-atm: Delete unnecessary return statements in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-19 20:20 +0200
Subject[PATCH 3/4] ueagle-atm: Delete unnecessary return statements in two functions
Message-ID<tIUFj-5T5-17@gated-at.bofh.it>
In reply to#1645796
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 19 May 2017 19:22:12 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement in the affected functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/usb/atm/ueagle-atm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 9725e6f2f301..0ca4ff3e6683 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1058,7 +1058,6 @@ static void __uea_load_page_e4(struct uea_softc *sc, u8 pageno, int boot)
 
 bad:
 	uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", blockno);
-	return;
 }
 
 static void uea_load_page_e4(struct work_struct *work)
@@ -2101,7 +2100,6 @@ static void uea_dispatch_cmv_e4(struct uea_softc *sc, struct intr_pkt *intr)
 			E4_FUNCTION_TYPE(cmv->wFunction),
 			E4_FUNCTION_SUBTYPE(cmv->wFunction));
 	uea_leaves(INS_TO_USBDEV(sc));
-	return;
 }
 
 static void uea_schedule_load_page_e1(struct uea_softc *sc,
-- 
2.13.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web