Staging: comedi: Fix unsigned return type
In each case, the function has an unsigned return type, but returns a negative constant to indicate an error condition. For move_block_from_dma, there is only one call and the return value is dropped, so it need not be unsigned. For labpc_eeprom_write, there is only one call and the result is stored in a signed variable, so again the unsigned return type is not necessary. A sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @exists@ identifier f; constant C; @@ unsigned f(...) { <+... * return -C; ...+> } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
7b1f6bfb03
Коммит
d6269644e1
|
@ -634,7 +634,7 @@ static unsigned int defragment_dma_buffer(struct comedi_device *dev,
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
static unsigned int move_block_from_dma(struct comedi_device *dev,
|
static int move_block_from_dma(struct comedi_device *dev,
|
||||||
struct comedi_subdevice *s,
|
struct comedi_subdevice *s,
|
||||||
short *dma_buffer,
|
short *dma_buffer,
|
||||||
unsigned int num_samples)
|
unsigned int num_samples)
|
||||||
|
|
|
@ -250,7 +250,7 @@ static unsigned int labpc_serial_in(struct comedi_device *dev);
|
||||||
static unsigned int labpc_eeprom_read(struct comedi_device *dev,
|
static unsigned int labpc_eeprom_read(struct comedi_device *dev,
|
||||||
unsigned int address);
|
unsigned int address);
|
||||||
static unsigned int labpc_eeprom_read_status(struct comedi_device *dev);
|
static unsigned int labpc_eeprom_read_status(struct comedi_device *dev);
|
||||||
static unsigned int labpc_eeprom_write(struct comedi_device *dev,
|
static int labpc_eeprom_write(struct comedi_device *dev,
|
||||||
unsigned int address,
|
unsigned int address,
|
||||||
unsigned int value);
|
unsigned int value);
|
||||||
static void write_caldac(struct comedi_device *dev, unsigned int channel,
|
static void write_caldac(struct comedi_device *dev, unsigned int channel,
|
||||||
|
@ -1986,8 +1986,8 @@ static unsigned int labpc_eeprom_read(struct comedi_device *dev,
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int labpc_eeprom_write(struct comedi_device *dev,
|
static int labpc_eeprom_write(struct comedi_device *dev,
|
||||||
unsigned int address, unsigned int value)
|
unsigned int address, unsigned int value)
|
||||||
{
|
{
|
||||||
const int write_enable_instruction = 0x6;
|
const int write_enable_instruction = 0x6;
|
||||||
const int write_instruction = 0x2;
|
const int write_instruction = 0x2;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче