diff options
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dvb-usb-init.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-init.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index dd8e0b94edba..2e23060cbbca 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -138,6 +138,9 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties | |||
138 | 138 | ||
139 | int ret = -ENOMEM,cold=0; | 139 | int ret = -ENOMEM,cold=0; |
140 | 140 | ||
141 | if (du != NULL) | ||
142 | *du = NULL; | ||
143 | |||
141 | if ((desc = dvb_usb_find_device(udev,props,&cold)) == NULL) { | 144 | if ((desc = dvb_usb_find_device(udev,props,&cold)) == NULL) { |
142 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); | 145 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); |
143 | return -ENODEV; | 146 | return -ENODEV; |
@@ -145,38 +148,40 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties | |||
145 | 148 | ||
146 | if (cold) { | 149 | if (cold) { |
147 | info("found a '%s' in cold state, will try to load a firmware",desc->name); | 150 | info("found a '%s' in cold state, will try to load a firmware",desc->name); |
148 | ret = usb_cypress_load_firmware(udev,props->firmware,props->usb_ctrl); | 151 | ret = dvb_usb_download_firmware(udev,props); |
149 | } else { | 152 | if (!props->no_reconnect) |
150 | info("found a '%s' in warm state.",desc->name); | ||
151 | d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | ||
152 | if (d == NULL) { | ||
153 | err("no memory for 'struct dvb_usb_device'"); | ||
154 | return ret; | 153 | return ret; |
154 | } | ||
155 | |||
156 | info("found a '%s' in warm state.",desc->name); | ||
157 | d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | ||
158 | if (d == NULL) { | ||
159 | err("no memory for 'struct dvb_usb_device'"); | ||
160 | return ret; | ||
161 | } | ||
162 | memset(d,0,sizeof(struct dvb_usb_device)); | ||
163 | |||
164 | d->udev = udev; | ||
165 | memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); | ||
166 | d->desc = desc; | ||
167 | d->owner = owner; | ||
168 | |||
169 | if (d->props.size_of_priv > 0) { | ||
170 | d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); | ||
171 | if (d->priv == NULL) { | ||
172 | err("no memory for priv in 'struct dvb_usb_device'"); | ||
173 | kfree(d); | ||
174 | return -ENOMEM; | ||
155 | } | 175 | } |
156 | memset(d,0,sizeof(struct dvb_usb_device)); | 176 | memset(d->priv,0,d->props.size_of_priv); |
157 | 177 | } | |
158 | d->udev = udev; | ||
159 | memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); | ||
160 | d->desc = desc; | ||
161 | d->owner = owner; | ||
162 | |||
163 | if (d->props.size_of_priv > 0) { | ||
164 | d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); | ||
165 | if (d->priv == NULL) { | ||
166 | err("no memory for priv in 'struct dvb_usb_device'"); | ||
167 | kfree(d); | ||
168 | return -ENOMEM; | ||
169 | } | ||
170 | memset(d->priv,0,d->props.size_of_priv); | ||
171 | } | ||
172 | 178 | ||
173 | usb_set_intfdata(intf, d); | 179 | usb_set_intfdata(intf, d); |
174 | 180 | ||
175 | if (du != NULL) | 181 | if (du != NULL) |
176 | *du = d; | 182 | *du = d; |
177 | 183 | ||
178 | ret = dvb_usb_init(d); | 184 | ret = dvb_usb_init(d); |
179 | } | ||
180 | 185 | ||
181 | if (ret == 0) | 186 | if (ret == 0) |
182 | info("%s successfully initialized and connected.",desc->name); | 187 | info("%s successfully initialized and connected.",desc->name); |