RE: Staging: comedi: add addi-data drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday, September 29, 2012 12:09 AM, Dan Carpenter wrote:
> Hi Ian, Hartley,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch c995fe9475e0: "Staging: comedi: add addi-data drivers" from 
> Feb 12, 2009, leads to the following Smatch complaint:
>
> drivers/staging/comedi/drivers/addi-data/addi_common.c:1590 i_ADDI_Attach()
>	 error: we previously assumed '(dev->board_ptr)->pc_EepromChip' could be null (see line 1522)
>
> drivers/staging/comedi/drivers/addi-data/addi_common.c
>   1521	
>   1522		if ((this_board->pc_EepromChip == NULL)
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^
> Smatch sees this.
>
>   1523			|| (strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {
>   1524		   /************************************/
>   1525			/* Test if more that 1 address used */
>   1526		   /************************************/
>
> [snip]
>
>   1586		/*  Read eepeom and fill addi_board Structure */
>   1587	
>   1588		if (this_board->i_PCIEeprom) {
>                     ^^^^^^^^^^^^^^^^^^^^^^^
>   1589			printk("\nPCI Eeprom used");
>   1590			if (!(strcmp(this_board->pc_EepromChip, "S5920"))) {
>                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
> These should probably be using the same variable, yes?  This code has
> been this way since the code was added to staging.

No.

pc_EepromChip is a 'char *'. The addi_data boardinfo sets this filed to the
string name of the eeprom device on the board. The strings are defined as:

#define ADDIDATA_93C76		"93C76"
#define ADDIDATA_S5920		"S5920"
#define ADDIDATA_S5933		"S5933"
#define ADDIDATA_9054		"9054"

I_PCIEeprom is an 'int', it's used as a flag in the boardinfo to indicate if
the board has an eeprom or not. It's set with these defines:

#define ADDIDATA_EEPROM		1
#define ADDIDATA_NO_EEPROM	0

>   1591				/*  Set 3 wait stait */
>   1592				if (!(strcmp(this_board->pc_DriverName, "apci035"))) {

The addi-data drivers are all a bit of a mess. They actually abuse the
comedi API and will not even work without modifying the comedi
core. They all use the 'insn_config' method incorrectly and the comedi
core function check_insn_config_length() will fail due to this.

I plan on trying to fix the addi-data drivers and at least salvage the
basic functionality for most of the drivers. Some of them might need
to be dropped completely but it would be nice to keep as many as
possible.

Regards,
Hartley

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux