ueagle-atm: Adjustments for eight function implementations
Subsystems (4)
cover ueagle-atm: Adjustments for eight function implementations
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.13.0
PATCH 1/4 ueagle-atm: Delete error messages for failed memory allocations in two functions
From: Markus Elfring <[email protected]>
Date: Fri, 19 May 2017 19:02:01 +0200
Omit two extra messages for memory allocation failures in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/usb/atm/ueagle-atm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/usb/atm/ueagle-atm.c +2 -6
@@ -868,10 +868,8 @@ static int uea_idma_write(struct uea_softc *sc, const void *data, u32 size)int bytes_read; xfer_buff =kmemdup (data, size,GFP_KERNEL ); -if (!xfer_buff) { -uea_err (INS_TO_USBDEV (sc),"can't allocate xfer_buff\n" ); +if (!xfer_buff)return ret; - } ret = usb_bulk_msg(sc->usb_dev, usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE),
@@ -1147,10 +1145,8 @@ static int uea_request(struct uea_softc *sc,int ret = -ENOMEM ; xfer_buff =kmemdup (data, size,GFP_KERNEL ); -if (!xfer_buff) { -uea_err (INS_TO_USBDEV (sc),"can't allocate xfer_buff\n" ); +if (!xfer_buff)return ret; - } ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0), UCDC_SEND_ENCAPSULATED_COMMAND,
Signature · 1 line
2.13.0
PATCH 2/4 ueagle-atm: Improve a size determination in uea_bind()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/usb/atm/ueagle-atm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/atm/ueagle-atm.c +1 -1
@@ -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 ;
Signature · 1 line
2.13.0
PATCH 3/4 ueagle-atm: Delete unnecessary return statements in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/usb/atm/ueagle-atm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/atm/ueagle-atm.c +0 -2
@@ -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,
Signature · 1 line
2.13.0
PATCH 4/4 ueagle-atm: Adjust three checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/usb/atm/ueagle-atm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/atm/ueagle-atm.c +3 -3
@@ -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 )
Signature · 1 line
2.13.0