From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 25 Sep 2024 19:00:23 +0200
Add a label so that three statements can be better reused at the end of
this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/usb/typec/ucsi/ucsi_ccg.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index b3ec799fc873..ed075a403d87 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -306,14 +306,14 @@ static int ccg_write(struct ucsi_ccg *uc, u16 rab, const u8 *data, u32 len)
status = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (status < 0) {
dev_err(uc->dev, "i2c_transfer failed %d\n", status);
- pm_runtime_put_sync(uc->dev);
- kfree(buf);
- return status;
+ goto put_sync;
}
+ status = 0;
+put_sync:
pm_runtime_put_sync(uc->dev);
kfree(buf);
- return 0;
+ return status;
}
static int ccg_op_region_update(struct ucsi_ccg *uc, u32 cci)
--
2.46.1
On Wed, Sep 25, 2024 at 07:32:32PM +0200, Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 25 Sep 2024 19:00:23 +0200 > > Add a label so that three statements can be better reused at the end of > this function implementation. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/ucsi/ucsi_ccg.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c > index b3ec799fc873..ed075a403d87 100644 > --- a/drivers/usb/typec/ucsi/ucsi_ccg.c > +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c > @@ -306,14 +306,14 @@ static int ccg_write(struct ucsi_ccg *uc, u16 rab, const u8 *data, u32 len) > status = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); > if (status < 0) { > dev_err(uc->dev, "i2c_transfer failed %d\n", status); > - pm_runtime_put_sync(uc->dev); > - kfree(buf); > - return status; > + goto put_sync; > } > > + status = 0; > +put_sync: > pm_runtime_put_sync(uc->dev); > kfree(buf); > - return 0; > + return status; > } > > static int ccg_op_region_update(struct ucsi_ccg *uc, u32 cci) > -- > 2.46.1 -- heikki
© 2016 - 2024 Red Hat, Inc.