Hi,

I might have found a minor bug in the bge(4) drivers.
if_bge.c line 504 has the following piece of code:

if (pa->pa_function != 0)
    bit = BGE_APE_LOCK_GRANT_DRIVER0;
else
    bit = (1 << pa->pa_function);

In this case the else statement will always set 'bit' to 1. I would
expect the if statement to check for the function to be equal to 0
instead of unequal. A patch is attached below.

Kind regards,

David

Index: sys/dev/pci/if_bge.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.316
diff -p -u -r1.316 if_bge.c
--- sys/dev/pci/if_bge.c        29 Jan 2013 00:41:02 -0000      1.316
+++ sys/dev/pci/if_bge.c        29 Mar 2013 09:20:44 -0000
@@ -501,7 +501,7 @@ bge_ape_lock_init(struct bge_softc *sc)
                        bit = BGE_APE_LOCK_GRANT_DRIVER0;
                        break;
                default:
-                       if (pa->pa_function != 0)
+                       if (pa->pa_function == 0)
                                bit = BGE_APE_LOCK_GRANT_DRIVER0;
                        else
                                bit = (1 << pa->pa_function);

Reply via email to