* usb: mtu3: Checking initialisation of the variable =?UTF-8?B?4oCcbWVw4oCdIGluIHR3by
@ 2020-06-27 12:28 Markus Elfring
2020-06-29 1:48 ` usb: mtu3: Checking initialisation of the variable “mep” in two func Chunfeng Yun
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2020-06-27 12:28 UTC (permalink / raw)
To: linux-mediatek, linux-usb, linux-arm-kernel, Chunfeng Yun,
Greg Kroah-Hartman, Matthias Brugger
Cc: Colin Ian King, kernel-janitors, LKML
Hello,
A source code analysis approach by the means of the semantic patch language
(Coccinelle software) pointed an implementation detail out for further
development considerations.
The functions “mtu3_gadget_ep_set_halt” and “mtu3_gadget_ep_set_wedge” check
at the beginning if the input parameter “ep” is a null pointer.
The error code “-EINVAL” will be returned then.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/mtu3/mtu3_gadget.c?id=1590a2e1c681b0991bd42c992cabfd380e0338f2#n371
https://elixir.bootlin.com/linux/v5.7.2/source/drivers/usb/mtu3/mtu3_gadget.c#L371
Can it be nicer to assign the variable “mep” only after a successful check
instead of an initialisation before?
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: usb: mtu3: Checking initialisation of the variable “mep” in two func
2020-06-27 12:28 usb: mtu3: Checking initialisation of the variable =?UTF-8?B?4oCcbWVw4oCdIGluIHR3by Markus Elfring
@ 2020-06-29 1:48 ` Chunfeng Yun
0 siblings, 0 replies; 2+ messages in thread
From: Chunfeng Yun @ 2020-06-29 1:48 UTC (permalink / raw)
To: Markus Elfring
Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors, LKML,
linux-mediatek, Matthias Brugger, Colin Ian King,
linux-arm-kernel
SGksDQpPbiBTYXQsIDIwMjAtMDYtMjcgYXQgMTQ6MjggKzAyMDAsIE1hcmt1cyBFbGZyaW5nIHdy
b3RlOg0KPiBIZWxsbywNCj4gDQo+IEEgc291cmNlIGNvZGUgYW5hbHlzaXMgYXBwcm9hY2gg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o+IFJlZ2FyZHMsDQo+IE1hcmt1cw0KDQo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-29 1:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 12:28 usb: mtu3: Checking initialisation of the variable =?UTF-8?B?4oCcbWVw4oCdIGluIHR3by Markus Elfring
2020-06-29 1:48 ` usb: mtu3: Checking initialisation of the variable “mep” in two func Chunfeng Yun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).