| .. | .. |
|---|
| 318 | 318 | rc = usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe, |
|---|
| 319 | 319 | command, 0xc0, 0, 1, data, 2); |
|---|
| 320 | 320 | |
|---|
| 321 | | - usb_stor_dbg(us, "Media status %02X %02X\n", data[0], data[1]); |
|---|
| 321 | + if (rc == USB_STOR_XFER_GOOD) |
|---|
| 322 | + usb_stor_dbg(us, "Media status %02X %02X\n", data[0], data[1]); |
|---|
| 322 | 323 | |
|---|
| 323 | 324 | return rc; |
|---|
| 324 | 325 | } |
|---|
| .. | .. |
|---|
| 438 | 439 | + MEDIA_INFO(us).blockshift + MEDIA_INFO(us).pageshift); |
|---|
| 439 | 440 | MEDIA_INFO(us).pba_to_lba = kcalloc(num_zones, sizeof(u16*), GFP_NOIO); |
|---|
| 440 | 441 | MEDIA_INFO(us).lba_to_pba = kcalloc(num_zones, sizeof(u16*), GFP_NOIO); |
|---|
| 442 | + if (MEDIA_INFO(us).pba_to_lba == NULL || MEDIA_INFO(us).lba_to_pba == NULL) |
|---|
| 443 | + return USB_STOR_TRANSPORT_ERROR; |
|---|
| 441 | 444 | |
|---|
| 442 | 445 | if (alauda_reset_media(us) != USB_STOR_XFER_GOOD) |
|---|
| 443 | 446 | return USB_STOR_TRANSPORT_ERROR; |
|---|
| .. | .. |
|---|
| 452 | 455 | static int alauda_check_media(struct us_data *us) |
|---|
| 453 | 456 | { |
|---|
| 454 | 457 | struct alauda_info *info = (struct alauda_info *) us->extra; |
|---|
| 455 | | - unsigned char status[2]; |
|---|
| 458 | + unsigned char *status = us->iobuf; |
|---|
| 459 | + int rc; |
|---|
| 456 | 460 | |
|---|
| 457 | | - alauda_get_media_status(us, status); |
|---|
| 461 | + rc = alauda_get_media_status(us, status); |
|---|
| 462 | + if (rc != USB_STOR_XFER_GOOD) { |
|---|
| 463 | + status[0] = 0xF0; /* Pretend there's no media */ |
|---|
| 464 | + status[1] = 0; |
|---|
| 465 | + } |
|---|
| 458 | 466 | |
|---|
| 459 | 467 | /* Check for no media or door open */ |
|---|
| 460 | 468 | if ((status[0] & 0x80) || ((status[0] & 0x1F) == 0x10) |
|---|