[PATCH 01/37] staging: comedi: check comedi_auto_config() params

Ian Abbott abbotti at mev.co.uk
Fri Apr 5 10:35:11 UTC 2013


On 2013/04/04 08:24 PM, Dan Carpenter wrote:
> On Thu, Apr 04, 2013 at 02:58:42PM +0100, Ian Abbott wrote:
>> diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
>> index 4724f27..4460814 100644
>> --- a/drivers/staging/comedi/drivers.c
>> +++ b/drivers/staging/comedi/drivers.c
>> @@ -410,6 +410,16 @@ int comedi_auto_config(struct device *hardware_device,
>>  	struct comedi_device *comedi_dev;
>>  	int ret;
>>  
>> +	if (!hardware_device) {
>> +		pr_warn("BUG! comedi_auto_config called with NULL hardware_device\n");
> 
> 
> WARN() would give you a nice stack trace for easy debugging.

I could do.  It should be a fairly obvious bug if it occurs though.  It
could maybe output the driver name as long as the driver parameter is
not NULL (assuming it really is pointing to a valid struct comedi_driver!).

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-



More information about the devel mailing list