Skip to content

Commit ef596c6

Browse files
Geert UytterhoevenArnd Bergmann
authored andcommitted
[POWERPC] ps3: always make sure were running on a PS3
Add missing checks to PS3 specific drivers ps3av and sys-manager to verify that we are actually running on a PS3 (pointed out by Arnd). Correct existing checks in other subsystems/drivers to return -ENODEV instead of zero. Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
1 parent 94b2a43 commit ef596c6

5 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎arch/powerpc/platforms/ps3/mm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static int __init ps3_mm_add_memory(void)
294294
unsigned long nr_pages;
295295

296296
if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
297-
return 0;
297+
return -ENODEV;
298298

299299
BUG_ON(!mem_init_done);
300300

‎arch/powerpc/platforms/ps3/system-bus.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int __init ps3_system_bus_init(void)
172172
int result;
173173

174174
if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
175-
return 0;
175+
return -ENODEV;
176176

177177
result = bus_register(&ps3_system_bus_type);
178178
BUG_ON(result);

‎drivers/ps3/ps3av.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <linux/reboot.h>
2525
#include <linux/kernel.h>
2626
#include <linux/ioctl.h>
27+
28+
#include <asm/firmware.h>
2729
#include <asm/lv1call.h>
2830
#include <asm/ps3av.h>
2931
#include <asm/ps3.h>
@@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3av_driver = {
947949

948950
static int ps3av_module_init(void)
949951
{
950-
int error = ps3_vuart_port_driver_register(&ps3av_driver);
952+
int error;
953+
954+
if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
955+
return -ENODEV;
956+
957+
error = ps3_vuart_port_driver_register(&ps3av_driver);
951958
if (error) {
952959
printk(KERN_ERR
953960
"%s: ps3_vuart_port_driver_register failed %d\n",

‎drivers/ps3/sys-manager.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
#include <linux/module.h>
2323
#include <linux/workqueue.h>
2424
#include <linux/reboot.h>
25+
26+
#include <asm/firmware.h>
2527
#include <asm/ps3.h>
28+
2629
#include "vuart.h"
2730

2831
MODULE_AUTHOR("Sony Corporation");
@@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_sys_manager = {
598601

599602
static int __init ps3_sys_manager_init(void)
600603
{
604+
if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
605+
return -ENODEV;
606+
601607
return ps3_vuart_port_driver_register(&ps3_sys_manager);
602608
}
603609

‎drivers/ps3/vuart.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ int __init ps3_vuart_bus_init(void)
10311031
pr_debug("%s:%d:\n", __func__, __LINE__);
10321032

10331033
if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
1034-
return 0;
1034+
return -ENODEV;
10351035

10361036
init_MUTEX(&vuart_bus_priv.probe_mutex);
10371037
result = bus_register(&ps3_vuart_bus);

0 commit comments

Comments
 (0)