gspca: add sanity check for mandatory operations
PATCH 1/1 gspca: add sanity check for mandatory operations
From: Márton Németh <[email protected]>
Add check for the mandatory config, init, start and pkt_scan gspca subdriver operations.
---
linux/drivers/media/video/gspca/gspca.c +6 -0
@@ -2035,6 +2035,12 @@return -ENODEV ; } +/* check for mandatory operations */ +BUG_ON (!sd_desc->config); +BUG_ON (!sd_desc->init); +BUG_ON (!sd_desc->start); +BUG_ON (!sd_desc->pkt_scan); +/* create the device */ if (dev_size <sizeof *gspca_dev) dev_size =sizeof *gspca_dev;
Quoted 13 lines · On Tue, 17 Nov 2009 07:47:40 +0100 Németh Márton <[email protected]> wrote:
From: Márton Németh <[email protected]>
Add check for the mandatory config, init, start and
pkt_scangspca subdriver operations.Signed-off-by Márton Németh <[email protected]>---
diff -r182b5f8fa160linux/drivers/media/video/gspca/gspca.c
---a/linux/drivers/media/video/gspca/gspca.cSun Nov 15
10:05:30 2009 +0100 +++b/linux/drivers/media/video/gspca/gspca.cTue Nov 17 07:42:34
2009 +0100 @@ -2035,6 +2035,12 @@ return-ENODEV;linux/drivers/media/video/gspca/gspca.c +0
-0}
linux/drivers/media/video/gspca/gspca.c line 2046
Quoted 10 lines
linux/drivers/media/video/gspca/gspca.c +6
-0+/* check for mandatory operations */ +BUG_ON (!sd_desc->config); +BUG_ON (!sd_desc->init); +BUG_ON (!sd_desc->start); +BUG_ON (!sd_desc->pkt_scan); +/* create the device */ if (dev_size <sizeof *gspca_dev) dev_size =sizeof *gspca_dev;
Hi Németh,
I don't think this is useful: the people who write the subdrivers know the mandatory parameters. If not, the system will simply oops at the first test...
Signature · 2 lines
Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/