diff mbox series

i2c:i2c-core-of:remove redundant dev_err message

Message ID 20200226103901.21520-1-tangbin@cmss.chinamobile.com
State Rejected
Headers show
Series i2c:i2c-core-of:remove redundant dev_err message | expand

Commit Message

Tang Bin Feb. 26, 2020, 10:39 a.m. UTC
of_i2c_register_device already contains error message, so remove
the redundant dev_err message

Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
---
 drivers/i2c/i2c-core-of.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Francesco Lavra Feb. 26, 2020, 10:58 a.m. UTC | #1
On 2/26/20 11:39 AM, tangbin wrote:
> of_i2c_register_device already contains error message, so remove
> the redundant dev_err message
> 
> Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
> ---
>   drivers/i2c/i2c-core-of.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
> index 6787c1f71..7b0a786d3 100644
> --- a/drivers/i2c/i2c-core-of.c
> +++ b/drivers/i2c/i2c-core-of.c
> @@ -103,9 +103,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
>   
>   		client = of_i2c_register_device(adap, node);
>   		if (IS_ERR(client)) {
> -			dev_err(&adap->dev,
> -				 "Failed to create I2C device for %pOF\n",
> -				 node);
> +			return PTR_ERR(client);

This looks like an unrelated (and wrong) change. Why would you alter the 
semantics of of_i2c_register_devices()? Besides, this function doesn't 
have a return value.
Wolfram Sang March 10, 2020, 10:52 a.m. UTC | #2
On Wed, Feb 26, 2020 at 11:58:41AM +0100, Francesco Lavra wrote:
> On 2/26/20 11:39 AM, tangbin wrote:
> > of_i2c_register_device already contains error message, so remove
> > the redundant dev_err message
> > 
> > Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
> > ---
> >   drivers/i2c/i2c-core-of.c | 6 +-----
> >   1 file changed, 1 insertion(+), 5 deletions(-)
> > 
> > diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
> > index 6787c1f71..7b0a786d3 100644
> > --- a/drivers/i2c/i2c-core-of.c
> > +++ b/drivers/i2c/i2c-core-of.c
> > @@ -103,9 +103,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
> >   		client = of_i2c_register_device(adap, node);
> >   		if (IS_ERR(client)) {
> > -			dev_err(&adap->dev,
> > -				 "Failed to create I2C device for %pOF\n",
> > -				 node);
> > +			return PTR_ERR(client);
> 
> This looks like an unrelated (and wrong) change. Why would you alter the
> semantics of of_i2c_register_devices()? Besides, this function doesn't have
> a return value.

Right. This is not correct.

In general, tangbin has a point, the error reporting is doubled. Lower
layers already report, so both(!) callers of of_i2c_register_device do
not need to. Since I am refactoring all this anyhow in "[RFC PATCH 5/7]
i2c: of: error message unification", I think I will just drop error
reporting in the callers there when resending the series (giving tanbin
credits for the removal).

Is this okay with everyone?
diff mbox series

Patch

diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
index 6787c1f71..7b0a786d3 100644
--- a/drivers/i2c/i2c-core-of.c
+++ b/drivers/i2c/i2c-core-of.c
@@ -103,9 +103,7 @@  void of_i2c_register_devices(struct i2c_adapter *adap)
 
 		client = of_i2c_register_device(adap, node);
 		if (IS_ERR(client)) {
-			dev_err(&adap->dev,
-				 "Failed to create I2C device for %pOF\n",
-				 node);
+			return PTR_ERR(client);
 			of_node_clear_flag(node, OF_POPULATED);
 		}
 	}
@@ -246,8 +244,6 @@  static int of_i2c_notify(struct notifier_block *nb, unsigned long action,
 
 		client = of_i2c_register_device(adap, rd->dn);
 		if (IS_ERR(client)) {
-			dev_err(&adap->dev, "failed to create client for '%pOF'\n",
-				 rd->dn);
 			put_device(&adap->dev);
 			of_node_clear_flag(rd->dn, OF_POPULATED);
 			return notifier_from_errno(PTR_ERR(client));