Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755688AbYJORsX (ORCPT ); Wed, 15 Oct 2008 13:48:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753375AbYJORsM (ORCPT ); Wed, 15 Oct 2008 13:48:12 -0400 Received: from mtagate4.de.ibm.com ([195.212.29.153]:46198 "EHLO mtagate4.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751434AbYJORsL (ORCPT ); Wed, 15 Oct 2008 13:48:11 -0400 Message-Id: <20081015174413.781182094@de.ibm.com> References: <20081015174215.337001494@de.ibm.com> User-Agent: quilt/0.46-1 Date: Wed, 15 Oct 2008 19:42:17 +0200 From: Martin Schwidefsky To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Heiko Carstens , Jan Glauber , Martin Schwidefsky Subject: [patch 2/5] qdio: remove incorrect memset Content-Disposition: inline; filename=002-qdio-strlen.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2286 Lines: 74 From: Jan Glauber Remove the memset since zeroing the string is not needed and use snprintf instead of sprintf. Signed-off-by: Jan Glauber Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/qdio_debug.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) Index: quilt-2.6/drivers/s390/cio/qdio_debug.c =================================================================== --- quilt-2.6.orig/drivers/s390/cio/qdio_debug.c +++ quilt-2.6/drivers/s390/cio/qdio_debug.c @@ -20,6 +20,7 @@ static struct dentry *debugfs_root; #define MAX_DEBUGFS_QUEUES 32 static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL }; static DEFINE_MUTEX(debugfs_mutex); +#define QDIO_DEBUGFS_NAME_LEN 40 void qdio_allocate_do_dbf(struct qdio_initialize *init_data) { @@ -152,17 +153,6 @@ static int qstat_seq_open(struct inode * filp->f_path.dentry->d_inode->i_private); } -static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name) -{ - memset(name, 0, sizeof(name)); - sprintf(name, "%s", dev_name(&cdev->dev)); - if (q->is_input_q) - sprintf(name + strlen(name), "_input"); - else - sprintf(name + strlen(name), "_output"); - sprintf(name + strlen(name), "_%d", q->nr); -} - static void remove_debugfs_entry(struct qdio_q *q) { int i; @@ -189,14 +179,17 @@ static struct file_operations debugfs_fo static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) { int i = 0; - char name[40]; + char name[QDIO_DEBUGFS_NAME_LEN]; while (debugfs_queues[i] != NULL) { i++; if (i >= MAX_DEBUGFS_QUEUES) return; } - get_queue_name(q, cdev, name); + snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%s_%d", + dev_name(&cdev->dev), + q->is_input_q ? "input" : "output", + q->nr); debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, debugfs_root, q, &debugfs_fops); } -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/