Skip to content

Commit 981c1fe

Browse files
bigguinessgregkh
authored andcommitted
staging: comedi: vmk80xx: remove "firmware version" kernel messages
During the attach of this driver a couple commands are sent to the hardware with usb_bulk_msg() to read the firmware version information. This information is then dumped as dev_info() kernel messages. Thee messages are just added noise and don't effect the operation of the driver. For simplicity, remove the messages as well as the then unused functions vmk80xx_read_eeprom() and vmk80xx_check_data_link(). This also fixes an issue reported by coverity about an out-of-bounds write in vmk80xx_read_eeprom(). Reported-by: coverity (CID 711413) Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7e4f1e7 commit 981c1fe

File tree

1 file changed

+0
-71
lines changed

1 file changed

+0
-71
lines changed

drivers/staging/comedi/drivers/vmk80xx.c

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ enum vmk80xx_model {
103103
VMK8061_MODEL
104104
};
105105

106-
struct firmware_version {
107-
unsigned char ic3_vers[32]; /* USB-Controller */
108-
unsigned char ic6_vers[32]; /* CPU */
109-
};
110-
111106
static const struct comedi_lrange vmk8061_range = {
112107
2, {
113108
UNI_RANGE(5),
@@ -156,68 +151,12 @@ static const struct vmk80xx_board vmk80xx_boardinfo[] = {
156151
struct vmk80xx_private {
157152
struct usb_endpoint_descriptor *ep_rx;
158153
struct usb_endpoint_descriptor *ep_tx;
159-
struct firmware_version fw;
160154
struct semaphore limit_sem;
161155
unsigned char *usb_rx_buf;
162156
unsigned char *usb_tx_buf;
163157
enum vmk80xx_model model;
164158
};
165159

166-
static int vmk80xx_check_data_link(struct comedi_device *dev)
167-
{
168-
struct vmk80xx_private *devpriv = dev->private;
169-
struct usb_device *usb = comedi_to_usb_dev(dev);
170-
unsigned int tx_pipe;
171-
unsigned int rx_pipe;
172-
unsigned char tx[1];
173-
unsigned char rx[2];
174-
175-
tx_pipe = usb_sndbulkpipe(usb, 0x01);
176-
rx_pipe = usb_rcvbulkpipe(usb, 0x81);
177-
178-
tx[0] = VMK8061_CMD_RD_PWR_STAT;
179-
180-
/*
181-
* Check that IC6 (PIC16F871) is powered and
182-
* running and the data link between IC3 and
183-
* IC6 is working properly
184-
*/
185-
usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval);
186-
usb_bulk_msg(usb, rx_pipe, rx, 2, NULL, HZ * 10);
187-
188-
return (int)rx[1];
189-
}
190-
191-
static void vmk80xx_read_eeprom(struct comedi_device *dev, int flag)
192-
{
193-
struct vmk80xx_private *devpriv = dev->private;
194-
struct usb_device *usb = comedi_to_usb_dev(dev);
195-
unsigned int tx_pipe;
196-
unsigned int rx_pipe;
197-
unsigned char tx[1];
198-
unsigned char rx[64];
199-
int cnt;
200-
201-
tx_pipe = usb_sndbulkpipe(usb, 0x01);
202-
rx_pipe = usb_rcvbulkpipe(usb, 0x81);
203-
204-
tx[0] = VMK8061_CMD_RD_VERSION;
205-
206-
/*
207-
* Read the firmware version info of IC3 and
208-
* IC6 from the internal EEPROM of the IC
209-
*/
210-
usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval);
211-
usb_bulk_msg(usb, rx_pipe, rx, 64, &cnt, HZ * 10);
212-
213-
rx[cnt] = '\0';
214-
215-
if (flag & IC3_VERSION)
216-
strncpy(devpriv->fw.ic3_vers, rx + 1, 24);
217-
else /* IC6_VERSION */
218-
strncpy(devpriv->fw.ic6_vers, rx + 25, 24);
219-
}
220-
221160
static void vmk80xx_do_bulk_msg(struct comedi_device *dev)
222161
{
223162
struct vmk80xx_private *devpriv = dev->private;
@@ -878,16 +817,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev,
878817

879818
usb_set_intfdata(intf, devpriv);
880819

881-
if (devpriv->model == VMK8061_MODEL) {
882-
vmk80xx_read_eeprom(dev, IC3_VERSION);
883-
dev_info(&intf->dev, "%s\n", devpriv->fw.ic3_vers);
884-
885-
if (vmk80xx_check_data_link(dev)) {
886-
vmk80xx_read_eeprom(dev, IC6_VERSION);
887-
dev_info(&intf->dev, "%s\n", devpriv->fw.ic6_vers);
888-
}
889-
}
890-
891820
if (devpriv->model == VMK8055_MODEL)
892821
vmk80xx_reset_device(dev);
893822

0 commit comments

Comments
 (0)