Skip to content

Commit

Permalink
lib8390: Replace panic() call with BUILD_BUG_ON
Browse files Browse the repository at this point in the history
Replace panic() call in lib8390.c with BUILD_BUG_ON()
since checking the size of struct e8390_pkt_hdr should
happen at compile-time.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Armin Wolf authored and David S. Miller committed Sep 29, 2020
1 parent e6b6be5 commit 2b2706a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/8390/lib8390.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
*/

#include <linux/build_bug.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
Expand Down Expand Up @@ -1018,8 +1019,7 @@ static void __NS8390_init(struct net_device *dev, int startp)
? (0x48 | ENDCFG_WTS | (ei_local->bigendian ? ENDCFG_BOS : 0))
: 0x48;

if (sizeof(struct e8390_pkt_hdr) != 4)
panic("8390.c: header struct mispacked\n");
BUILD_BUG_ON(sizeof(struct e8390_pkt_hdr) != 4);
/* Follow National Semi's recommendations for initing the DP83902. */
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); /* 0x21 */
ei_outb_p(endcfg, e8390_base + EN0_DCFG); /* 0x48 or 0x49 */
Expand Down

0 comments on commit 2b2706a

Please sign in to comment.