[patch 1/1] Check return code for IBM Olympic /proc entry creation

From: domen
Date: Sat May 28 2005 - 18:17:12 EST

From: Kirk True <kernel@xxxxxxxxxxxxxxxxx>

The IBM Olympic driver assumes that the call to create_proc_read_entry
always succeeds. This patch simply logs appropriately whether in
actuality it was created or not.

This falls under the 'Audit return codes (and handle failure correctly)
for create_proc_*()' item on the TODO list. Also added KERN_* constants
as per Christophe Lucas' recommendation.

Signed-off-by: Kirk True <kirk@xxxxxxxxxxxxxxxxx>
Signed-off-by: Domen Puncer <domen@xxxxxxxxxxxx>

olympic.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

Index: quilt/drivers/net/tokenring/olympic.c
--- quilt.orig/drivers/net/tokenring/olympic.c
+++ quilt/drivers/net/tokenring/olympic.c
@@ -267,11 +267,16 @@ static int __devinit olympic_probe(struc
register_netdev(dev) ;
printk("Olympic: %s registered as: %s\n",olympic_priv->olympic_card_name,dev->name);
if (olympic_priv->olympic_network_monitor) { /* Must go after register_netdev as we need the device name */
+ struct proc_dir_entry *proc_dir_entry;
char proc_name[20] ;
strcpy(proc_name,"net/olympic_") ;
strcat(proc_name,dev->name) ;
- create_proc_read_entry(proc_name,0,NULL,olympic_proc_info,(void *)dev) ;
- printk("Olympic: Network Monitor information: /proc/%s\n",proc_name);
+ proc_dir_entry = create_proc_read_entry(proc_name,0,NULL,olympic_proc_info,dev);
+ if (proc_dir_entry)
+ printk(KERN_INFO "Olympic: Network Monitor information: /proc/%s\n",proc_name);
+ else
+ printk(KERN_WARNING "Olympic: Network Monitor information: /proc/%s could not be created\n",proc_name);
return 0 ;

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html