summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/usb/atm
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/usb/atm')
-rw-r--r--kernel/drivers/usb/atm/cxacru.c7
-rw-r--r--kernel/drivers/usb/atm/speedtch.c18
-rw-r--r--kernel/drivers/usb/atm/ueagle-atm.c4
-rw-r--r--kernel/drivers/usb/atm/usbatm.c6
-rw-r--r--kernel/drivers/usb/atm/xusbatm.c6
5 files changed, 28 insertions, 13 deletions
diff --git a/kernel/drivers/usb/atm/cxacru.c b/kernel/drivers/usb/atm/cxacru.c
index 813d4d3a5..1173f9cbc 100644
--- a/kernel/drivers/usb/atm/cxacru.c
+++ b/kernel/drivers/usb/atm/cxacru.c
@@ -270,6 +270,7 @@ static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf)
{
static char *str[] = { "no", "yes" };
+
if (unlikely(value >= ARRAY_SIZE(str)))
return snprintf(buf, PAGE_SIZE, "%u\n", value);
return snprintf(buf, PAGE_SIZE, "%s\n", str[value]);
@@ -278,6 +279,7 @@ static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf)
static ssize_t cxacru_sysfs_showattr_LINK(u32 value, char *buf)
{
static char *str[] = { NULL, "not connected", "connected", "lost" };
+
if (unlikely(value >= ARRAY_SIZE(str) || str[value] == NULL))
return snprintf(buf, PAGE_SIZE, "%u\n", value);
return snprintf(buf, PAGE_SIZE, "%s\n", str[value]);
@@ -702,6 +704,7 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
len = ret / 4;
for (offb = 0; offb < len; ) {
int l = le32_to_cpu(buf[offb++]);
+
if (l < 0 || l > stride || l > (len - offb) / 2) {
if (printk_ratelimit())
usb_err(instance->usbatm, "invalid data length from cm %#x: %d\n",
@@ -732,6 +735,7 @@ cleanup:
static int cxacru_card_status(struct cxacru_data *instance)
{
int ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0);
+
if (ret < 0) { /* firmware not loaded */
usb_dbg(instance->usbatm, "cxacru_adsl_start: CARD_GET_STATUS returned %d\n", ret);
return ret;
@@ -945,6 +949,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw,
offb = offd = 0;
do {
int l = min_t(int, stride, size - offd);
+
buf[offb++] = fw;
buf[offb++] = l;
buf[offb++] = code1;
@@ -1091,8 +1096,8 @@ static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
{
const struct firmware *fw, *bp;
struct cxacru_data *instance = usbatm_instance->driver_data;
-
int ret = cxacru_find_firmware(instance, "fw", &fw);
+
if (ret) {
usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n");
return ret;
diff --git a/kernel/drivers/usb/atm/speedtch.c b/kernel/drivers/usb/atm/speedtch.c
index 0dc8c06a7..0270d1312 100644
--- a/kernel/drivers/usb/atm/speedtch.c
+++ b/kernel/drivers/usb/atm/speedtch.c
@@ -255,7 +255,8 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
usb_dbg(usbatm, "%s entered\n", __func__);
- if (!(buffer = (unsigned char *)__get_free_page(GFP_KERNEL))) {
+ buffer = (unsigned char *)__get_free_page(GFP_KERNEL);
+ if (!buffer) {
ret = -ENOMEM;
usb_dbg(usbatm, "%s: no memory for buffer!\n", __func__);
goto out;
@@ -638,7 +639,8 @@ static void speedtch_handle_int(struct urb *int_urb)
goto fail;
}
- if ((int_urb = instance->int_urb)) {
+ int_urb = instance->int_urb;
+ if (int_urb) {
ret = usb_submit_urb(int_urb, GFP_ATOMIC);
schedule_work(&instance->status_check_work);
if (ret < 0) {
@@ -650,7 +652,8 @@ static void speedtch_handle_int(struct urb *int_urb)
return;
fail:
- if ((int_urb = instance->int_urb))
+ int_urb = instance->int_urb;
+ if (int_urb)
mod_timer(&instance->resubmit_timer, jiffies + msecs_to_jiffies(RESUBMIT_DELAY));
}
@@ -759,11 +762,13 @@ static void speedtch_release_interfaces(struct usb_device *usb_dev,
struct usb_interface *cur_intf;
int i;
- for (i = 0; i < num_interfaces; i++)
- if ((cur_intf = usb_ifnum_to_if(usb_dev, i))) {
+ for (i = 0; i < num_interfaces; i++) {
+ cur_intf = usb_ifnum_to_if(usb_dev, i);
+ if (cur_intf) {
usb_set_intfdata(cur_intf, NULL);
usb_driver_release_interface(&speedtch_usb_driver, cur_intf);
}
+ }
}
static int speedtch_bind(struct usbatm_data *usbatm,
@@ -787,7 +792,8 @@ static int speedtch_bind(struct usbatm_data *usbatm,
return -ENODEV;
}
- if (!(data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA))) {
+ data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA);
+ if (!data_intf) {
usb_err(usbatm, "%s: data interface not found!\n", __func__);
return -ENODEV;
}
diff --git a/kernel/drivers/usb/atm/ueagle-atm.c b/kernel/drivers/usb/atm/ueagle-atm.c
index 888998a7f..a2ae88dbd 100644
--- a/kernel/drivers/usb/atm/ueagle-atm.c
+++ b/kernel/drivers/usb/atm/ueagle-atm.c
@@ -1599,7 +1599,7 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
char file_arr[] = "CMVxy.bin";
char *file;
- kparam_block_sysfs_write(cmv_file);
+ kernel_param_lock(THIS_MODULE);
/* set proper name corresponding modem version and line type */
if (cmv_file[sc->modem_index] == NULL) {
if (UEA_CHIP_VERSION(sc) == ADI930)
@@ -1618,7 +1618,7 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
strlcat(cmv_name, file, UEA_FW_NAME_MAX);
if (ver == 2)
strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX);
- kparam_unblock_sysfs_write(cmv_file);
+ kernel_param_unlock(THIS_MODULE);
}
static int request_cmvs_old(struct uea_softc *sc,
diff --git a/kernel/drivers/usb/atm/usbatm.c b/kernel/drivers/usb/atm/usbatm.c
index dada0146c..db322d9cc 100644
--- a/kernel/drivers/usb/atm/usbatm.c
+++ b/kernel/drivers/usb/atm/usbatm.c
@@ -382,7 +382,8 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
"%s: got packet (length: %u, pdu_length: %u, vcc: 0x%p)",
__func__, length, pdu_length, vcc);
- if (!(skb = dev_alloc_skb(length))) {
+ skb = dev_alloc_skb(length);
+ if (!skb) {
if (printk_ratelimit())
atm_err(instance, "%s: no memory for skb (length: %u)!\n",
__func__, length);
@@ -816,7 +817,8 @@ static int usbatm_atm_open(struct atm_vcc *vcc)
goto fail;
}
- if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
+ new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL);
+ if (!new) {
atm_err(instance, "%s: no memory for vcc_data!\n", __func__);
ret = -ENOMEM;
goto fail;
diff --git a/kernel/drivers/usb/atm/xusbatm.c b/kernel/drivers/usb/atm/xusbatm.c
index b3b1bb78b..a87597f88 100644
--- a/kernel/drivers/usb/atm/xusbatm.c
+++ b/kernel/drivers/usb/atm/xusbatm.c
@@ -73,7 +73,8 @@ static int xusbatm_capture_intf(struct usbatm_data *usbatm, struct usb_device *u
usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, ifnum, ret);
return ret;
}
- if ((ret = usb_set_interface(usb_dev, ifnum, altsetting))) {
+ ret = usb_set_interface(usb_dev, ifnum, altsetting);
+ if (ret) {
usb_err(usbatm, "%s: altsetting %2d for interface %2d failed (%d)!\n", __func__, altsetting, ifnum, ret);
return ret;
}
@@ -128,7 +129,8 @@ static int xusbatm_bind(struct usbatm_data *usbatm,
rx_intf->altsetting->desc.bInterfaceNumber,
tx_intf->altsetting->desc.bInterfaceNumber);
- if ((ret = xusbatm_capture_intf(usbatm, usb_dev, rx_intf, rx_alt, rx_intf != intf)))
+ ret = xusbatm_capture_intf(usbatm, usb_dev, rx_intf, rx_alt, rx_intf != intf);
+ if (ret)
return ret;
if ((tx_intf != rx_intf) && (ret = xusbatm_capture_intf(usbatm, usb_dev, tx_intf, tx_alt, tx_intf != intf))) {