* [patch] smscufx: change edid data to u8 instead of char
@ 2011-09-21 7:16 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2011-09-21 7:16 UTC (permalink / raw)
To: linux-fbdev
Having "edid" as char caused a problem in ufx_read_edid() where we
compared "edid[i] != 0xFF". Because of the type difference, the
condition was never true and the error checking failed.
Also I added a __user notation to silence a sparse complaint.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Compile tested only. Please test carefully.
diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c
index 44c8cab..aaccffa 100644
--- a/drivers/video/smscufx.c
+++ b/drivers/video/smscufx.c
@@ -103,7 +103,7 @@ struct ufx_data {
struct delayed_work free_framebuffer_work;
atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
- char *edid; /* null until we read edid from hw or get from sysfs */
+ u8 *edid; /* null until we read edid from hw or get from sysfs */
size_t edid_size;
u32 pseudo_palette[256];
};
@@ -993,7 +993,7 @@ static int ufx_ops_ioctl(struct fb_info *info, unsigned int cmd,
/* TODO: Update X server to get this from sysfs instead */
if (cmd = UFX_IOCTL_RETURN_EDID) {
- char *edid = (char *)arg;
+ u8 __user *edid = (u8 __user *)arg;
if (copy_to_user(edid, dev->edid, dev->edid_size))
return -EFAULT;
return 0;
@@ -1428,7 +1428,7 @@ static int ufx_i2c_wait_busy(struct ufx_data *dev)
}
/* reads a 128-byte EDID block from the currently selected port and TAR */
-static int ufx_read_edid(struct ufx_data *dev, char *edid, int edid_len)
+static int ufx_read_edid(struct ufx_data *dev, u8 *edid, int edid_len)
{
int i, j, status;
u32 *edid_u32 = (u32 *)edid;
@@ -1491,7 +1491,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
char *default_edid, size_t default_edid_size)
{
const struct fb_videomode *default_vmode = NULL;
- char *edid;
+ u8 *edid;
int i, result = 0, tries = 3;
if (info->dev) /* only use mutex if info has been registered */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] smscufx: change edid data to u8 instead of char
@ 2011-10-04 20:19 Florian Tobias Schandinat
0 siblings, 0 replies; 2+ messages in thread
From: Florian Tobias Schandinat @ 2011-10-04 20:19 UTC (permalink / raw)
To: linux-fbdev
On 09/21/2011 07:16 AM, Dan Carpenter wrote:
> Having "edid" as char caused a problem in ufx_read_edid() where we
> compared "edid[i] != 0xFF". Because of the type difference, the
> condition was never true and the error checking failed.
>
> Also I added a __user notation to silence a sparse complaint.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
Thanks,
Florian Tobias Schandinat
> ---
> Compile tested only. Please test carefully.
>
> diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c
> index 44c8cab..aaccffa 100644
> --- a/drivers/video/smscufx.c
> +++ b/drivers/video/smscufx.c
> @@ -103,7 +103,7 @@ struct ufx_data {
> struct delayed_work free_framebuffer_work;
> atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
> atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
> - char *edid; /* null until we read edid from hw or get from sysfs */
> + u8 *edid; /* null until we read edid from hw or get from sysfs */
> size_t edid_size;
> u32 pseudo_palette[256];
> };
> @@ -993,7 +993,7 @@ static int ufx_ops_ioctl(struct fb_info *info, unsigned int cmd,
>
> /* TODO: Update X server to get this from sysfs instead */
> if (cmd = UFX_IOCTL_RETURN_EDID) {
> - char *edid = (char *)arg;
> + u8 __user *edid = (u8 __user *)arg;
> if (copy_to_user(edid, dev->edid, dev->edid_size))
> return -EFAULT;
> return 0;
> @@ -1428,7 +1428,7 @@ static int ufx_i2c_wait_busy(struct ufx_data *dev)
> }
>
> /* reads a 128-byte EDID block from the currently selected port and TAR */
> -static int ufx_read_edid(struct ufx_data *dev, char *edid, int edid_len)
> +static int ufx_read_edid(struct ufx_data *dev, u8 *edid, int edid_len)
> {
> int i, j, status;
> u32 *edid_u32 = (u32 *)edid;
> @@ -1491,7 +1491,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
> char *default_edid, size_t default_edid_size)
> {
> const struct fb_videomode *default_vmode = NULL;
> - char *edid;
> + u8 *edid;
> int i, result = 0, tries = 3;
>
> if (info->dev) /* only use mutex if info has been registered */
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-04 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21 7:16 [patch] smscufx: change edid data to u8 instead of char Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2011-10-04 20:19 Florian Tobias Schandinat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox