From 2f939a6d2f2e4d5b677e643e06a11b385c804c8a Mon Sep 17 00:00:00 2001 From: Vipul Kumar Date: Thu, 10 Jan 2019 12:46:50 +0530 Subject: [PATCH] usb: typec: Fix return type of tcpci_register_port() function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch fix the return type of tcpci_register_port() to fix the compilation warnings. drivers/usb/typec/tcpci.c: In function ‘tcpci_register_port’: drivers/usb/typec/tcpci.c:882:10: warning: returning ‘int’ from a function with return type ‘struct tcpci *’ makes pointer from integer without a cast [-Wint-conversion] return -ENOMEM; ^ drivers/usb/typec/tcpci.c:888:10: warning: returning ‘int’ from a function with return type ‘struct tcpci *’ makes pointer from integer without a cast [-Wint-conversion] return err; ^~~ drivers/usb/typec/tcpci.c: In function ‘tcpci_probe’: drivers/usb/typec/tcpci.c:914:6: warning: unused variable ‘val’ [-Wunused-variable] u16 val = 0; ^~~ AR drivers/usb/typec/built-in.a Signed-off-by: Vipul Kumar --- drivers/usb/typec/tcpci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpci.c b/drivers/usb/typec/tcpci.c index 40b8f3bae90b..655aa78d43ae 100644 --- a/drivers/usb/typec/tcpci.c +++ b/drivers/usb/typec/tcpci.c @@ -748,13 +748,13 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) tcpci_extcon_cable); if (IS_ERR(tcpci->edev)) { dev_err(dev, "failed to allocate extcon dev.\n"); - return -ENOMEM; + return ERR_CAST(tcpci->edev); } err = devm_extcon_dev_register(dev, tcpci->edev); if (err) { dev_err(dev, "failed to register extcon dev.\n"); - return err; + return ERR_PTR(err); } err = tcpci_parse_config(tcpci); @@ -780,7 +780,6 @@ static int tcpci_probe(struct i2c_client *client, { struct tcpci_chip *chip; int err; - u16 val = 0; chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) -- 2.17.1