Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

roel kluin and committed by
Benjamin Herrenschmidt
e7eec2fc 9146cfc8

+13 -5
+1 -1
arch/powerpc/include/asm/ps3av.h
··· 730 730 extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, 731 731 u32); 732 732 733 - extern int ps3av_set_video_mode(u32); 733 + extern int ps3av_set_video_mode(int); 734 734 extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32); 735 735 extern int ps3av_get_auto_mode(void); 736 736 extern int ps3av_get_mode(void);
+12 -4
drivers/ps3/ps3av.c
··· 838 838 } 839 839 840 840 /* set mode using id */ 841 - int ps3av_set_video_mode(u32 id) 841 + int ps3av_set_video_mode(int id) 842 842 { 843 843 int size; 844 844 u32 option; ··· 940 940 static int ps3av_probe(struct ps3_system_bus_device *dev) 941 941 { 942 942 int res; 943 - u32 id; 943 + int id; 944 944 945 945 dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__); 946 946 dev_dbg(&dev->core, " timeout=%d\n", timeout); ··· 962 962 init_completion(&ps3av->done); 963 963 complete(&ps3av->done); 964 964 ps3av->wq = create_singlethread_workqueue("ps3avd"); 965 - if (!ps3av->wq) 965 + if (!ps3av->wq) { 966 + res = -ENOMEM; 966 967 goto fail; 968 + } 967 969 968 970 switch (ps3_os_area_get_av_multi_out()) { 969 971 case PS3_PARAM_AV_MULTI_OUT_NTSC: ··· 996 994 safe_mode = 1; 997 995 #endif /* CONFIG_FB */ 998 996 id = ps3av_auto_videomode(&ps3av->av_hw_conf); 997 + if (id < 0) { 998 + printk(KERN_ERR "%s: invalid id :%d\n", __func__, id); 999 + res = -EINVAL; 1000 + goto fail; 1001 + } 1002 + 999 1003 safe_mode = 0; 1000 1004 1001 1005 mutex_lock(&ps3av->mutex); ··· 1015 1007 fail: 1016 1008 kfree(ps3av); 1017 1009 ps3av = NULL; 1018 - return -ENOMEM; 1010 + return res; 1019 1011 } 1020 1012 1021 1013 static int ps3av_remove(struct ps3_system_bus_device *dev)