Skip to content

Commit e7eec2f

Browse files
RoelKluinozbenh
authored andcommitted
powerpc/ps3: Make ps3av_set_video_mode mode ID signed
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 <roel.kluin@gmail.com> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 9146cfc commit e7eec2f

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎arch/powerpc/include/asm/ps3av.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ extern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *);
730730
extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
731731
u32);
732732

733-
extern int ps3av_set_video_mode(u32);
733+
extern int ps3av_set_video_mode(int);
734734
extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
735735
extern int ps3av_get_auto_mode(void);
736736
extern int ps3av_get_mode(void);

‎drivers/ps3/ps3av.c‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ static int ps3av_get_hw_conf(struct ps3av *ps3av)
838838
}
839839

840840
/* set mode using id */
841-
int ps3av_set_video_mode(u32 id)
841+
int ps3av_set_video_mode(int id)
842842
{
843843
int size;
844844
u32 option;
@@ -940,7 +940,7 @@ EXPORT_SYMBOL_GPL(ps3av_audio_mute);
940940
static int ps3av_probe(struct ps3_system_bus_device *dev)
941941
{
942942
int res;
943-
u32 id;
943+
int id;
944944

945945
dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
946946
dev_dbg(&dev->core, " timeout=%d\n", timeout);
@@ -962,8 +962,10 @@ static int ps3av_probe(struct ps3_system_bus_device *dev)
962962
init_completion(&ps3av->done);
963963
complete(&ps3av->done);
964964
ps3av->wq = create_singlethread_workqueue("ps3avd");
965-
if (!ps3av->wq)
965+
if (!ps3av->wq) {
966+
res = -ENOMEM;
966967
goto fail;
968+
}
967969

968970
switch (ps3_os_area_get_av_multi_out()) {
969971
case PS3_PARAM_AV_MULTI_OUT_NTSC:
@@ -994,6 +996,12 @@ static int ps3av_probe(struct ps3_system_bus_device *dev)
994996
safe_mode = 1;
995997
#endif /* CONFIG_FB */
996998
id = ps3av_auto_videomode(&ps3av->av_hw_conf);
999+
if (id < 0) {
1000+
printk(KERN_ERR "%s: invalid id :%d\n", __func__, id);
1001+
res = -EINVAL;
1002+
goto fail;
1003+
}
1004+
9971005
safe_mode = 0;
9981006

9991007
mutex_lock(&ps3av->mutex);
@@ -1007,7 +1015,7 @@ static int ps3av_probe(struct ps3_system_bus_device *dev)
10071015
fail:
10081016
kfree(ps3av);
10091017
ps3av = NULL;
1010-
return -ENOMEM;
1018+
return res;
10111019
}
10121020

10131021
static int ps3av_remove(struct ps3_system_bus_device *dev)

0 commit comments

Comments
 (0)