Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-usb@vger.kernel.org, "Ajay Gupta" <ajayg@nvidia.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Haotien Hsu" <haotienh@nvidia.com>,
	"Utkarsh Patel" <utkarsh.h.patel@intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Wolfram Sang" <wsa@the-dreams.de>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] usb: typec: ucsi: ccg: Use common code in ccg_write()
Date: Thu, 26 Sep 2024 17:53:44 +0300	[thread overview]
Message-ID: <ZvV1eBoM95w3mT8A@kuha.fi.intel.com> (raw)
In-Reply-To: <983e8bde-513c-4053-b33e-06a1b10eef87@web.de>

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

  reply	other threads:[~2024-09-26 14:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 17:31 [PATCH 0/2] usb: typec: ucsi: ccg: Adjustments for common code in two functions Markus Elfring
2024-09-25 17:32 ` [PATCH 1/2] usb: typec: ucsi: ccg: Use common code in ccg_write() Markus Elfring
2024-09-26 14:53   ` Heikki Krogerus [this message]
2024-09-25 17:33 ` [PATCH 2/2] usb: typec: ucsi: ccg: Use common code in ccg_read() Markus Elfring
2024-09-26 14:54   ` Heikki Krogerus
2024-09-25 21:26 ` [PATCH 0/2] usb: typec: ucsi: ccg: Adjustments for common code in two functions Dmitry Baryshkov
2024-09-26 12:12   ` Andy Shevchenko
2024-09-26 12:20     ` Dmitry Baryshkov
2024-09-26 12:27       ` Andy Shevchenko
2024-09-26 12:31         ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZvV1eBoM95w3mT8A@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=Markus.Elfring@web.de \
    --cc=ajayg@nvidia.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haotienh@nvidia.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=utkarsh.h.patel@intel.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox