Skip to contentSkip to conversation

extcon: max77843: fix an error code in max77843_init_muic_regmap()

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 15, 2015 – Mar 23, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 extcon: max77843: fix an error code in max77843_init_muic_regmap()

"max77843->i2c_muic" is NULL, not an error code. Let's return -ENODEV here.

drivers/extcon/extcon-max77843.c +1 -1
index a3f80ca..6f0ed5a 100644
@@ -715,7 +715,7 @@ static int max77843_init_muic_regmap(struct max77843 *max77843)
 	if (!max77843->i2c_muic) {
 		dev_err(&max77843->i2c->dev,
 				"Cannot allocate I2C device for MUIC\n");
-		return PTR_ERR(max77843->i2c_muic);
+		return -ENODEV;
 	}
 
 	i2c_set_clientdata(max77843->i2c_muic, max77843);
maintainer
#1 lore raw

Hi Dan,

Quoted 10 lines · Dan Carpenter

"max77843->i2c_muic" is NULL, not an error code. Let's return -ENODEV here.

drivers/extcon/extcon-max77843.c +0 -0
index a3f80ca..6f0ed5a 100644

drivers/extcon/extcon-max77843.c static int max77843_init_muic_regmap(struct max77843 *max77843) · line 718

Quoted 5 lines
drivers/extcon/extcon-max77843.c +1 -1
@@ -715,7 +715,7 @@ static int max77843_init_muic_regmap(struct max77843 *max77843)
 	if (!max77843->i2c_muic) {
 		dev_err(&max77843->i2c->dev,
 				"Cannot allocate I2C device for MUIC\n");
-		return PTR_ERR(max77843->i2c_muic);
+		return -ENODEV;

I think that -ENOMEM is more proper error than -ENODEV. So, I'll use -ENOMEM value and applied it on extcon-next branch.

Thanks,
Chanwoo Choi

Quoted 4 lines
drivers/extcon/extcon-max77843.c +0 -0
 	}
 
 	i2c_set_clientdata(max77843->i2c_muic, max77843);