Skip to content

Commit

Permalink
powerpc/ps3: Make ps3av_set_video_mode mode ID signed
Browse files Browse the repository at this point in the history
Change the ps3av_auto_videomode() mode id argument type from unsigned to
signed so a negative id can be detected and reported as an -EINVAL failure.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: Geoff Levand <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
RoelKluin authored and ozbenh committed Mar 11, 2009
1 parent 9146cfc commit e7eec2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/ps3av.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ extern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *);
extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
u32);

extern int ps3av_set_video_mode(u32);
extern int ps3av_set_video_mode(int);
extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
extern int ps3av_get_auto_mode(void);
extern int ps3av_get_mode(void);
Expand Down
16 changes: 12 additions & 4 deletions drivers/ps3/ps3av.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ static int ps3av_get_hw_conf(struct ps3av *ps3av)
}

/* set mode using id */
int ps3av_set_video_mode(u32 id)
int ps3av_set_video_mode(int id)
{
int size;
u32 option;
Expand Down Expand Up @@ -940,7 +940,7 @@ EXPORT_SYMBOL_GPL(ps3av_audio_mute);
static int ps3av_probe(struct ps3_system_bus_device *dev)
{
int res;
u32 id;
int id;

dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
dev_dbg(&dev->core, " timeout=%d\n", timeout);
Expand All @@ -962,8 +962,10 @@ static int ps3av_probe(struct ps3_system_bus_device *dev)
init_completion(&ps3av->done);
complete(&ps3av->done);
ps3av->wq = create_singlethread_workqueue("ps3avd");
if (!ps3av->wq)
if (!ps3av->wq) {
res = -ENOMEM;
goto fail;
}

switch (ps3_os_area_get_av_multi_out()) {
case PS3_PARAM_AV_MULTI_OUT_NTSC:
Expand Down Expand Up @@ -994,6 +996,12 @@ static int ps3av_probe(struct ps3_system_bus_device *dev)
safe_mode = 1;
#endif /* CONFIG_FB */
id = ps3av_auto_videomode(&ps3av->av_hw_conf);
if (id < 0) {
printk(KERN_ERR "%s: invalid id :%d\n", __func__, id);
res = -EINVAL;
goto fail;
}

safe_mode = 0;

mutex_lock(&ps3av->mutex);
Expand All @@ -1007,7 +1015,7 @@ static int ps3av_probe(struct ps3_system_bus_device *dev)
fail:
kfree(ps3av);
ps3av = NULL;
return -ENOMEM;
return res;
}

static int ps3av_remove(struct ps3_system_bus_device *dev)
Expand Down

0 comments on commit e7eec2f

Please sign in to comment.