From bc6491027d370304c19fdfe853fdebabc235be4d Mon Sep 17 00:00:00 2001 From: Madalin Bucur Date: Mon, 25 Aug 2014 17:29:26 +0300 Subject: dpaa_eth: check qman_query_cgr return value Signed-off-by: Madalin Bucur Change-Id: I21558e105b5c3092e96b7e98b570e5613e8bc771 Reviewed-on: http://git.am.freescale.net:8181/17399 Reviewed-by: Cristian Bercaru diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c b/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c index a5665ac..1f22bd7 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c @@ -135,16 +135,21 @@ static int dpa_debugfs_show(struct seq_file *file, void *offset) seq_printf(file, "Device has been congested for %d ms.\n", jiffies_to_msecs(priv->cgr_data.congested_jiffies)); - qman_query_cgr(&priv->cgr_data.cgr, &query_cgr); - seq_printf(file, "CGR id %d avg count: %llu\n", - priv->cgr_data.cgr.cgrid, qm_mcr_querycgr_a_get64(&query_cgr)); - seq_printf(file, "Device entered congestion %u times. ", - priv->cgr_data.cgr_congested_count); - seq_printf(file, "Current congestion state is: %s.\n", - query_cgr.cgr.cs ? "congested" : "not congested"); - /* Reset congestion stats (like QMan CGR API does) */ - priv->cgr_data.congested_jiffies = 0; - priv->cgr_data.cgr_congested_count = 0; + if (qman_query_cgr(&priv->cgr_data.cgr, &query_cgr) != 0) { + seq_printf(file, "CGR id %d - failed to query values\n", + priv->cgr_data.cgr.cgrid); + } else { + seq_printf(file, "CGR id %d avg count: %llu\n", + priv->cgr_data.cgr.cgrid, + qm_mcr_querycgr_a_get64(&query_cgr)); + seq_printf(file, "Device entered congestion %u times. ", + priv->cgr_data.cgr_congested_count); + seq_printf(file, "Current congestion state is: %s.\n", + query_cgr.cgr.cs ? "congested" : "not congested"); + /* Reset congestion stats (like QMan CGR API does) */ + priv->cgr_data.congested_jiffies = 0; + priv->cgr_data.cgr_congested_count = 0; + } /* Rx Errors demultiplexing */ seq_puts(file, "\nDPA RX Errors:\nCPU dma err phys err"); -- cgit v0.10.2