Re: [PATCH 1/8] staging: unisys: add toolaction to sysfs

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

 



On Sat, Jul 19, 2014 at 10:26:54AM -0400, Benjamin Romer wrote:
> +ssize_t show_toolaction(struct device *dev, struct device_attribute *attr,
> +		char *buf)
> +{
> +	if (ControlVm_channel) {
> +		U8 toolAction;
> +
> +		visorchannel_read(ControlVm_channel,
> +			offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
> +				   ToolAction), &toolAction, sizeof(U8));
> +		return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction);
> +	} else
> +		return -ENODEV;
> +}
> +
> +ssize_t store_toolaction(struct device *dev, struct device_attribute *attr,
> +		const char *buf, size_t count)
> +{
> +	if (ControlVm_channel) {
> +		U8 toolAction;
> +
> +		if (sscanf(buf, "%hhu\n", &toolAction) == 1) {
> +			if (visorchannel_write(ControlVm_channel,
> +				offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
> +					ToolAction),
> +				&toolAction, sizeof(U8)) < 0)
> +					return -EFAULT;
> +				else
> +					return count;
> +		} else
> +			return -EIO;
> +	} else
> +		return -ENODEV;
> +}

How could ControlVm_channel ever be NULL?  Don't check for this, as the
file shouldn't even be here if ControlVm_channel is null.

Same goes for the other sysfs files in this patch series.

thanks,

greg k-h
_______________________________________________
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