Changeset a6abe20 in mainline


Ignore:
Timestamp:
2015-06-30T03:09:18Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
26d6f73
Parents:
f9599b9c
Message:

usbmast: Sanitize logging

Report the error condition.
Don't use custom verbosity control, that's what logctl_set_log_level is for.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/bo_trans.c

    rf9599b9c ra6abe20  
    4444#include "usbmast.h"
    4545
    46 bool usb_mast_verbose = false;
    4746
    4847#define MASTLOG(format, ...) \
    49         do { \
    50                 if (usb_mast_verbose) { \
    51                         usb_log_debug2("USB cl08: " format, ##__VA_ARGS__); \
    52                 } \
    53         } while (false)
     48        usb_log_debug2("USB cl08: " format, ##__VA_ARGS__)
    5449
    5550/** Send command via bulk-only transport.
     
    9388            usb_debug_str_buffer((uint8_t *) &cbw, sizeof(cbw), 0),
    9489            str_error(rc));
    95         if (rc != EOK)
    96                 return EIO;
     90        if (rc != EOK) {
     91                usb_log_error("Bulk out write failed: %s\n", str_error(rc));
     92                return EIO;
     93        }
    9794
    9895        MASTLOG("Transferring data.\n");
     
    119116                    usb_device_get_default_pipe(mfun->mdev->usb_dev), dpipe);
    120117        } else if (rc != EOK) {
     118                usb_log_error("Failed to transfer data: %s", str_error(rc));
    121119                return EIO;
    122120        }
     
    131129            str_error(rc));
    132130        if (rc != EOK) {
    133                 MASTLOG("rc != EOK\n");
     131                usb_log_error("Failed to read CSW: %s", str_error(rc));
    134132                return EIO;
    135133        }
    136134
    137135        if (csw_size != sizeof(csw)) {
    138                 MASTLOG("csw_size != sizeof(csw)\n");
     136                usb_log_error("Received CSW of incorrect size.");
    139137                return EIO;
    140138        }
    141139
    142140        if (csw.dCSWTag != tag) {
    143                 MASTLOG("csw.dCSWTag != tag\n");
     141                usb_log_error("Received CSW with incorrect tag. (expected: %"
     142                    PRIX32" received: %"PRIx32, tag, csw.dCSWTag);
    144143                return EIO;
    145144        }
     
    153152                break;
    154153        case cbs_failed:
    155                 MASTLOG("Command failed\n");
    156154                cmd->status = CMDS_FAILED;
     155                usb_log_error("CBS Failed.\n");
    157156                break;
    158157        case cbs_phase_error:
    159                 MASTLOG("Phase error\n");
     158                usb_log_error("CBS phase error.\n");
    160159                rc = EIO;
    161160                break;
    162161        default:
     162                usb_log_error("CBS other error.\n");
    163163                rc = EIO;
    164164                break;
     
    167167        const size_t residue = uint32_usb2host(csw.dCSWDataResidue);
    168168        if (residue > dbuf_size) {
    169                 MASTLOG("residue > dbuf_size\n");
     169                usb_log_error("Residue > buffer size (%zu > %zu).\n",
     170                    residue, dbuf_size);
    170171                return EIO;
    171172        }
Note: See TracChangeset for help on using the changeset viewer.