archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: Remove unnecessary verification
@ 2020-10-21 21:28 Gustavo Pimentel
  0 siblings, 0 replies; only message in thread
From: Gustavo Pimentel @ 2020-10-21 21:28 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann,
	Greg Kroah-Hartman
  Cc: Joao Pinto, Gustavo Pimentel, linux-pci, linux-kernel

The first condition of the if statement can never be true, because
bar variable is an enum variable type defined between 0 and 5, and
also bar variable acquires the value from arg function parameter which
is an unsigned long variable.

The constant 5 was replaced the the equivalent enum type, in this case

Signed-off-by: Gustavo Pimentel <>
 drivers/misc/pci_endpoint_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index e060796..b86f9f7 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -704,7 +704,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
 	switch (cmd) {
 		bar = arg;
-		if (bar < 0 || bar > 5)
+		if (bar > BAR_5)
 			goto ret;
 		if (is_am654_pci_dev(pdev) && bar == BAR_0)
 			goto ret;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-21 21:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 21:28 [PATCH] misc: pci_endpoint_test: Remove unnecessary verification Gustavo Pimentel

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).