Re: [PATCHv4 06/16] staging: usbip: Add proper error reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 19, 2013 at 04:39:09PM +0200, Dominik Paulus wrote:
> +const char *usbip_net_strerror(int status)
> +{
> +	static const char *const errs[] = {
> +		/* ERR_OK */ "Success",
> +		/* ERR_NA */ "Command failed",
> +		/* ERR_MISMATCH */ "Protocol version mismatch",
> +		/* ERR_SYSERR */ "System error",
> +		/* ERR_UNEXPECTED */ "Unexpected opcode received",
> +		/* ERR_AUTHREQ */ "Server requires authentication",
> +		/* ERR_PERM */ "Permission denied",
> +		/* ERR_NOTFOUND */ "Requested device not found",
> +		/* ERR_NOAUTH */ "Server doesn't support authentication"
> +	};
> +	if (status < 0)
> +		status = -status;
> +	if (status >= (int) (sizeof(errs) / sizeof(*errs)))

Not a big deal, but for future reference, the cast here is unneeded.

> +		return "Invalid";
> +	return errs[status];
>  }

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux