From 726bb4d924aec30a6bc7276531b79168cf426812 Mon Sep 17 00:00:00 2001 From: Nathan Lynch Date: Mon, 24 Mar 2008 09:51:45 +1100 Subject: [PATCH] --- yaml --- r: 91455 b: refs/heads/master c: f61fb8a52cdf8b9b6a6badde84aefe58cb35d315 h: refs/heads/master i: 91453: 6d5c54610b627ce23bf92b42372ef5681c71ab43 91451: c87ca533d859b666e725da9e62e5919d72c3a89a 91447: 2f96dd6ddc587b96ac74d88b382994b104a9c5a4 91439: f7f39a199012fd2d3ad83f6162b41a49664795d8 91423: 61482c167d8a3e35754ff750ed4b3cc4df121000 91391: 168191d62a9f94c989d646a627c2b3fd346b7200 v: v3 --- [refs] | 2 +- .../arch/powerpc/platforms/pseries/scanlog.c | 37 +++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/[refs] b/[refs] index b4df299b9ab2..1d661c4574a7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9356d90effa39c83c8fdba2a14cecec79959d4d0 +refs/heads/master: f61fb8a52cdf8b9b6a6badde84aefe58cb35d315 diff --git a/trunk/arch/powerpc/platforms/pseries/scanlog.c b/trunk/arch/powerpc/platforms/pseries/scanlog.c index 8e1ef168e2dd..e5b0ea870164 100644 --- a/trunk/arch/powerpc/platforms/pseries/scanlog.c +++ b/trunk/arch/powerpc/platforms/pseries/scanlog.c @@ -195,31 +195,30 @@ const struct file_operations scanlog_fops = { static int __init scanlog_init(void) { struct proc_dir_entry *ent; + void *data; + int err = -ENOMEM; ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); - if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) { - printk(KERN_ERR "scan-log-dump not implemented on this system\n"); - return -EIO; - } + if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) + return -ENODEV; - ent = create_proc_entry("ppc64/rtas/scan-log-dump", S_IRUSR, NULL); - if (ent) { - ent->proc_fops = &scanlog_fops; - /* Ideally we could allocate a buffer < 4G */ - ent->data = kmalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); - if (!ent->data) { - printk(KERN_ERR "Failed to allocate a buffer\n"); - remove_proc_entry("scan-log-dump", ent->parent); - return -ENOMEM; - } - ((unsigned int *)ent->data)[0] = 0; - } else { - printk(KERN_ERR "Failed to create ppc64/scan-log-dump proc entry\n"); - return -EIO; - } + /* Ideally we could allocate a buffer < 4G */ + data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); + if (!data) + goto err; + + ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, + &scanlog_fops); + if (!ent) + goto err; + + ent->data = data; proc_ppc64_scan_log_dump = ent; return 0; +err: + kfree(data); + return err; } static void __exit scanlog_cleanup(void)