[PATCH 2/11] staging: udlfb: fbdev character read and write support

Jiri Slaby jirislaby at gmail.com
Thu Aug 19 10:05:45 UTC 2010


On 08/18/2010 10:39 PM, Bernie Thompson wrote:
> +static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf,
> +			  size_t count, loff_t *ppos)
> +{
> +	ssize_t result = -ENOSYS;
> +	struct dlfb_data *dev = info->par;
> +	u32 offset = (u32) *ppos;
> +
> +#if defined CONFIG_FB_SYS_FOPS || defined CONFIG_FB_SYS_FOPS_MODULE
> +
> +	result = fb_sys_write(info, buf, count, ppos);
> +
> +	if (result > 0) {
> +		int start = max((int)(offset / info->fix.line_length) - 1, 0);
> +		int lines = min((u32)((result / info->fix.line_length) + 1),
> +				(u32)info->var.yres);

This looks bogus. You are casting to u32 in min and then assigning to
int. First,  min_t and max_t helpers exist and should be used instead of
casting. Second, why you cast to u32 and assign the result to int?

thanks,
-- 
js



More information about the devel mailing list