From: Markus Elfring elfr...@users.sourceforge.net
Date: Thu, 20 Nov 2014 16:11:56 +0100
The kfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by:
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 14:51:43 +0100
The rndis_add_hdr() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 15:20:12 +0100
The pci_dev_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 15:50:44 +0100
The usb_put_dev() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 16:15:34 +0100
The release_firmware() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 16:33:18 +0100
The usb_put_dev() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c
index ab1d690..3653ec1 100644
--- a/drivers/usb/serial/mxuport.c
+++ b/drivers/usb/serial/mxuport.c
@@ -1101,8 +1101,7 @@ static int mxuport_probe(struct usb_serial *serial,
*/
usb_set_serial_data(serial,
From: Markus Elfring elfr...@users.sourceforge.net
Date: Thu, 5 Feb 2015 16:33:09 +0100
The release_firmware() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Thu, 5 Feb 2015 16:07:43 +0100
The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle
From: Markus Elfring elfr...@users.sourceforge.net
Date: Thu, 5 Feb 2015 16:54:12 +0100
The usb_put_hcd() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Thu, 5 Feb 2015 21:40:29 +0100
The umc_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring elfr...@users.sourceforge.net
Date: Sun, 28 Jun 2015 14:59:04 +0200
The release_firmware() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
From: Markus Elfring
Date: Mon, 16 Nov 2015 19:01:44 +0100
The dma_pool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.
This issue was detected by using the Coccinelle software.
> Fortunately it does not matter anyway because the return value
> of the drop_link() operation is silently ignored by its caller in
> fs/configfs/symlink.c, functions configfs_symlink() and configfs_unlink().
Should such an implementation detail be also reconsidered once more?
Regards,
Markus
From: Markus Elfring
Date: Fri, 1 Jan 2016 16:54:13 +0100
Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Fri, 1 Jan 2016 17:32:07 +0100
Reduce the scope for the local variable "desc" to one branch
of an if statement.
Signed-off-by: Markus Elfring
---
drivers/net/usb/qmi_wwan.c | 3 ++-
1 file changed, 2
From: Markus Elfring
Date: Fri, 1 Jan 2016 17:47:46 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Refactoring for qmi_wwan_bind()
Delete an unnecessary variable initialisation in
From: Markus Elfring
Date: Fri, 1 Jan 2016 17:35:03 +0100
Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.
Signed-off-by: Markus Elfring
---
drivers/net/usb/qmi_wwan.c | 2
> We added a new error path to this function and we forgot to drop the lock.
>
> Fixes: e1e3d7ec5da3 ('usb: gadget: f_midi: pre-allocate IN requests')
> Signed-off-by: Dan Carpenter
>
> diff --git a/drivers/usb/gadget/function/f_midi.c
>
From: Markus Elfring
Date: Tue, 22 Dec 2015 16:43:12 +0100
Another update suggestion was taken into account after a patch was applied
from static source code analysis.
Markus Elfring (2):
Use a signed return type for fhci_create_ep()
Use a signed return type
From: Markus Elfring
Date: Sat, 19 Dec 2015 21:10:20 +0100
The return type "u32" was used by the fhci_create_ep() function even though
it will eventually return a negative error code.
Improve this implementation detail by using the type "s32" instead.
This issue
> Just make it an int.
Thanks for your suggestion.
Will any more software developers prefer this data type
at some source code places?
> The caller also casts it to u32...
Do you want to get rid of similar casts in affected functions?
Regards,
Markus
--
To unsubscribe from this list: send
From: Markus Elfring
Date: Tue, 22 Dec 2015 16:10:14 +0100
The return type "u32" was used by the fhci_create_ep() function even though
it will eventually return a negative error code.
Improve this implementation detail by using the type "int" instead.
This issue
From: Markus Elfring
Date: Tue, 22 Dec 2015 16:24:46 +0100
The return type "u32" was used by the endpoint_zero_init() function
even though it can return a value which corresponds to a negative
error code from a call of the fhci_create_ep() function.
Improve this
From: Markus Elfring
Date: Sun, 21 Aug 2016 15:41:23 +0200
Several update suggestions were taken into account
from static source code analysis.
Markus Elfring (7):
Use memdup_user() rather than duplicating its implementation
Delete unnecessary initialisations
From: Markus Elfring
Date: Sun, 21 Aug 2016 13:26:09 +0200
The local variable "dev" was initialised despite of the detail
that it was immediately reassigned by the following statement.
Thus remove such unnecessary specifications.
Signed-off-by: Markus Elfring
From: Markus Elfring
Date: Sun, 21 Aug 2016 12:48:27 +0200
Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
From: Markus Elfring
Date: Sun, 21 Aug 2016 13:45:09 +0200
The local variable "retval" will be set to an appropriate value
a bit later. Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Sun, 21 Aug 2016 15:15:03 +0200
Two local variables will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Sun, 21 Aug 2016 15:17:22 +0200
Two local variables will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Sun, 21 Aug 2016 15:25:30 +0200
Do not use curly brackets at a few source code places
where a single statement should be sufficient.
Signed-off-by: Markus Elfring
---
drivers/usb/misc/iowarrior.c | 22
From: Markus Elfring
Date: Sun, 21 Aug 2016 15:30:11 +0200
The script "checkpatch.pl" can point out that assignments should usually
not be performed within condition checks.
Thus move the assignments for two local variables to separate statements.
Signed-off-by:
From: Markus Elfring
Date: Mon, 22 May 2017 07:04:03 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation
Improve a size determination
From: Markus Elfring
Date: Mon, 22 May 2017 06:33:48 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link:
From: Markus Elfring
Date: Mon, 22 May 2017 06:42:33 +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
From: Markus Elfring
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
From: Markus Elfring
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.
Link:
From: Markus Elfring
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
From: Markus Elfring
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.
From: Markus Elfring
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
From: Markus Elfring
Date: Fri, 19 May 2017 22:30:21 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link:
From: Markus Elfring
Date: Mon, 28 Aug 2017 22:46:30 +0200
Fix a word in this description.
Signed-off-by: Markus Elfring
---
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
From: Markus Elfring
Date: Mon, 28 Aug 2017 22:23:56 +0200
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Tue, 29 Aug 2017 07:17:07 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Delete an error message for a failed memory allocation in two functions
Improve a size
From: Markus Elfring
Date: Mon, 28 Aug 2017 22:40:47 +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
From: Markus Elfring
Date: Mon, 28 Aug 2017 22:28:02 +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
From: Markus Elfring
Date: Sat, 4 Nov 2017 19:36:56 +0100
* Adjust jump targets so that two error messages are stored only once
at the end of these function implementations.
* Replace 11 calls of the function "dev_err" and 11 assignments to
the variable "rv"
From: Markus Elfring
Date: Sat, 4 Nov 2017 21:00:46 +0100
* Add jump targets so that a call of the function "mutex_unlock" is stored
only twice in these function implementations.
* Replace five calls by goto statements.
This issue was detected by using the
>> @@ -5529,8 +5528,7 @@ static int usb_reset_and_verify_device(struct
>> usb_device *udev)
>> dev_err(>dev,
>> "can't restore configuration #%d (error=%d)\n",
>> udev->actconfig->desc.bConfigurationValue, ret);
>> -
> Don't worry, or waste your time, I don't take patches from this author
> as they are in my blacklist.
I am curious if our dialogue can become more constructive again.
I can offer another bit of information for this software development
discussion.
The affected source files can be
> If you play the "smaller executable object code" card, people expect that
> you provide the actual numbers, too.
I can offer another bit of information for this software development discussion.
The affected source file can be compiled for the processor architecture “x86_64”
by a tool like “GCC
From: Markus Elfring
Date: Sat, 4 Nov 2017 22:02:46 +0100
Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "dev_err" by goto statements.
This issue was detected by
From: Markus Elfring
Date: Tue, 5 Dec 2017 20:30:50 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Tue, 5 Dec 2017 20:43:31 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Tue, 5 Dec 2017 22:40:30 +0100
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
Signed-off-by: Markus Elfring
---
drivers/usb/usbip/stub_rx.c | 22
From: Markus Elfring
Date: Tue, 5 Dec 2017 22:44:55 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation in two functions
Use common error handling
From: Markus Elfring
Date: Tue, 5 Dec 2017 22:25:38 +0100
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Tue, 5 Dec 2017 21:17:55 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Delete an error message for a failed memory allocation in hwarc_probe()
Delete an error message for
From: Markus Elfring
Date: Tue, 5 Dec 2017 21:07:47 +0100
Omit extra messages for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Tue, 5 Dec 2017 21:00:03 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
> Greg maintains USB and he's has blocked Markus,
How do you think about to reconsider this blockage?
> because he never listens to feedback
I am listening …
> but instead just repsonds that he has a different opinion.
I choose such a reaction in some cases. My responses can vary.
It seems
OOM does a dump_stack() so this function's call tree is shown.
>>>
>>> A call stack doesn't tell you which device was being handled.
>>
>> Do you find a default Linux allocation failure report insufficient then?
>>
>> Would you like to to achieve that the requested information can be
>> Omit an extra message for a memory allocation failure in these functions.
>>
>> This issue was detected by using the Coccinelle software.
>
> Please include the problem
Do you find the wording “WARNING: Possible unnecessary 'out of memory' message”
from the script “checkpatch.pl” more
> The system will come to a grinding halt anyway if it can't allocate 24 or 40
> bytes.
Maybe.
> Which is BTW more or less the amount of memory saved by killing
> the useless (error) message.
Would you dare to resend this update suggestion after such a view?
Regards,
Markus
--
To unsubscribe
From: Markus Elfring
Date: Wed, 6 Dec 2017 17:00:18 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
>>> Does the existing memory allocation error message include the
>>> >dev device name and driver name? If it doesn't, there will be
>>> no way for the user to tell that the error message is related to the
>>> device failure.
>>
>> No, but the effect is similar.
>>
>> OOM does a dump_stack()
From: Markus Elfring
Date: Wed, 6 Dec 2017 12:42:20 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Wed, 6 Dec 2017 13:03:21 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
>> @@ -42,10 +42,9 @@ static int emi26_writememory (struct usb_device *dev, int
>> address,
>> int result;
>> unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);
>>
>> -if (!buffer) {
>> -dev_err(>dev, "kmalloc(%d) failed.\n", length);
>
> I guess the length
From: Markus Elfring
Date: Wed, 6 Dec 2017 13:23:35 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Wed, 6 Dec 2017 16:16:00 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Sat, 28 Oct 2017 22:42:52 +0200
* Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
* Replace two calls of the function "netdev_err" by goto statements.
* Adjust two
>> @@ -700,10 +700,9 @@ static int sr9800_phy_powerup(struct usbnet *dev)
>>
>> /* set the embedded Ethernet PHY in power-up state */
>> ret = sr_sw_reset(dev, SR_SWRESET_IPRL);
>> - if (ret < 0) {
>> - netdev_err(dev->net, "Failed to reset PHY: %d\n", ret);
>>
From: Markus Elfring
Date: Sun, 29 Oct 2017 11:08:34 +0100
Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "netdev_warn" by goto statements.
This issue was
From: Markus Elfring
Date: Sun, 29 Oct 2017 11:33:14 +0100
Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "netdev_err" by goto statements.
This issue was detected
> Regarding posts from Markus' I am well aware of the problems.
Interesting …
> In my case, it hasn't been much of a hurdle, I simply ignore changes
> that seems silly to me.
* How often did this happen so far?
* Are any update suggestions left over where a constructive feedback
will make
>>> What's the advantage of this patch? The new code seems more complicated
>>> to me and GCC automatically reuses duplicate constant strings so there
>>> is no memory savings.
>>
>> It looked to me that the error path got a bit cleaner. However, I
>> guess it's matter of taste.
>>
>> If you
From: Markus Elfring
Date: Fri, 27 Oct 2017 21:21:40 +0200
Add a jump target so that a specific string copy operation is stored
only once at the end of this function implementation.
Replace two calls of the function "strncpy" by goto statements.
This issue was
From: Markus Elfring
Date: Sun, 31 Dec 2017 22:06:49 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
---
From: Markus Elfring
Date: Sat, 13 Jan 2018 13:12:06 +0100
A single character (line break) should be put into a sequence.
Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
>> Use three values directly for a condition check without assigning them
>> to intermediate variables.
>
> Hi,
>
> what is the benefit of this?
I proposed a small source code reduction.
Other software design directions might become more interesting for this use
case.
Regards,
Markus
--
To
From: Markus Elfring
Date: Sat, 10 Mar 2018 18:22:43 +0100
Adjust a jump target so that a bit of common code can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
From: Markus Elfring
Date: Sat, 10 Mar 2018 19:05:45 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use common code
Delete three unnecessary variables
drivers/net/usb/ax88179_178a.c | 45
From: Markus Elfring
Date: Sat, 10 Mar 2018 18:53:28 +0100
Use three values directly for a condition check without assigning them
to intermediate variables.
Signed-off-by: Markus Elfring
---
drivers/net/usb/ax88179_178a.c | 13
84 matches
Mail list logo