Patchwork mv88e6060: Warn about errors

login
register
mail settings
Submitter Pavel Machek
Date Dec. 6, 2018, 1:01 p.m.
Message ID <20181206130145.GB22343@amd>
Download mbox | patch
Permalink /patch/674103/
State New
Headers show

Comments

Pavel Machek - Dec. 6, 2018, 1:01 p.m.
Errors communicating with the chip are not expected, warn about them.
    
Signed-off-by: Pavel Machek <pavel@ucw.cz>
David Miller - Dec. 6, 2018, 8:21 p.m.
Plain "printk" are never appropriate.

Please explicitly use pr_warn() or similar.  If there is a device context
available, either a generic device or a netdev, use one of the dev_*()
or netdev_*() variants.
Pavel Machek - Dec. 6, 2018, 8:36 p.m.
On Thu 2018-12-06 12:21:59, David Miller wrote:
> 
> Plain "printk" are never appropriate.
> 
> Please explicitly use pr_warn() or similar.  If there is a device context
> available, either a generic device or a netdev, use one of the dev_*()
> or netdev_*() variants.

Can do, I guess.... is there's agreeement that such error is worth
some kind of output to the logs?

Best regards,
									Pavel

Patch

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 65f10fec25b3..f43104f48dbb 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -30,8 +30,10 @@  static int reg_read(struct dsa_switch *ds, int addr, int reg)
 		int __ret;					\
 								\
 		__ret = reg_read(ds, addr, reg);		\
-		if (__ret < 0)					\
+		if (__ret < 0) {				\
+			printk("mv88e6060: error reading %x/%x\n", addr, reg);	\
 			return __ret;				\
+		}						\
 		__ret;						\
 	})
 
@@ -48,8 +50,10 @@  static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
 		int __ret;					\
 								\
 		__ret = reg_write(ds, addr, reg, val);		\
-		if (__ret < 0)					\
+		if (__ret < 0)  {                               \
+			printk("mv88e6060: error writing %x/%x\n", addr, reg);	\
 			return __ret;				\
+		}						\
 	})
 
 static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)