ndiscvt(8): abort if no IDs were found during conversion.

Checked with Broadcom driver mentioned in PR 179285.

PR:		69268
Submitted by:	<darius@dons.net.au>
MFC after:	5 days
This commit is contained in:
Andriy Voskoboinyk 2019-01-30 12:32:47 +00:00
parent a99bdc110b
commit 602fa83239
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343576
2 changed files with 16 additions and 13 deletions

View File

@ -62,9 +62,9 @@ static struct assign
(struct assign *);
static struct section
*find_section (const char *);
static void dump_deviceids_pci (void);
static void dump_deviceids_pcmcia (void);
static void dump_deviceids_usb (void);
static int dump_deviceids_pci (void);
static int dump_deviceids_pcmcia (void);
static int dump_deviceids_usb (void);
static void dump_pci_id (const char *);
static void dump_pcmcia_id (const char *);
static void dump_usb_id (const char *);
@ -85,9 +85,11 @@ inf_parse (FILE *fp, FILE *outfp)
yyin = fp;
yyparse();
dump_deviceids_pci();
dump_deviceids_pcmcia();
dump_deviceids_usb();
if (dump_deviceids_pci() == 0 &&
dump_deviceids_pcmcia() == 0 &&
dump_deviceids_usb() == 0)
return (-1);
fprintf(outfp, "#ifdef NDIS_REGVALS\n");
dump_regvals();
fprintf(outfp, "#endif /* NDIS_REGVALS */\n");
@ -280,7 +282,7 @@ dump_usb_id(const char *s)
fprintf(ofp, "\t\\\n\t{ %s, %s, ", vidstr, pidstr);
}
static void
static int
dump_deviceids_pci()
{
struct assign *manf, *dev;
@ -370,10 +372,10 @@ dump_deviceids_pci()
fprintf(ofp, "\n\n");
return;
return (found);
}
static void
static int
dump_deviceids_pcmcia()
{
struct assign *manf, *dev;
@ -463,10 +465,10 @@ dump_deviceids_pcmcia()
fprintf(ofp, "\n\n");
return;
return (found);
}
static void
static int
dump_deviceids_usb()
{
struct assign *manf, *dev;
@ -556,7 +558,7 @@ dump_deviceids_usb()
fprintf(ofp, "\n\n");
return;
return (found);
}
static void

View File

@ -372,7 +372,8 @@ main(int argc, char *argv[])
err(1, "opening .INF file '%s' failed", inffile);
inf_parse(fp, outfp);
if (inf_parse(fp, outfp) != 0)
errx(1, "creating .INF file - no entries created, are you using the correct files?");
fclose(fp);
}