netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jinjian Song <songjinjian@hotmail.com>
Cc: netdev@vger.kernel.org, chandrashekar.devegowda@intel.com,
	chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com,
	m.chetan.kumar@linux.intel.com, ricardo.martinez@linux.intel.com,
	loic.poulain@linaro.org, ryazanov.s.a@gmail.com,
	johannes@sipsolutions.net, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux-kernel@vger.kernel.com, vsankar@lenovo.com,
	danielwinkler@google.com, nmarupaka@google.com,
	joey.zhao@fibocom.com, liuqf@fibocom.com, felix.yan@fibocom.com,
	Jinjian Song <jinjian.song@fibocom.com>
Subject: Re: [PATCH v1] net: wwan: t7xx: Add fastboot interface
Date: Thu, 21 Dec 2023 18:53:32 +0100	[thread overview]
Message-ID: <20231221175332.GD1202958@kernel.org> (raw)
In-Reply-To: <MEYP282MB26975911A05EB464E9548BA8BB95A@MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM>

On Thu, Dec 21, 2023 at 03:09:51PM +0800, Jinjian Song wrote:
> From: Jinjian Song <jinjian.song@fibocom.com>
> 
> To support cases such as firmware update or core dump, the t7xx
> device is capable of signaling the host that a special port needs
> to be created before the handshake phase.
> 
> Adds the infrastructure required to create the early ports which
> also requires a different configuration of CLDMA queues.
> 
> On early detection of wwan device in fastboot mode, driver sets
> up CLDMA0 HW tx/rx queues for raw data transfer and then create
> fastboot port to user space.
> 
> Signed-off-by: Jinjian Song <jinjian.song@fibocom.com>

...

> @@ -729,8 +792,17 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	t7xx_pcie_mac_interrupts_dis(t7xx_dev);
>  
> +	ret = sysfs_create_group(&t7xx_dev->pdev->dev.kobj,
> +				 &t7xx_mode_attribute_group);
> +	if (ret) {
> +		t7xx_md_exit(t7xx_dev);
> +		return ret;
> +	}

Hi Jinjian,

Please consider using goto labels for unwind on error in this function.
Something like this (completely untested!):

	if (ret)
		goto err_md_exit;

	...
	if (ret)
		goto err_remove_group;

	...
	return 0;

err_remove_group:
	sysfs_remove_group(&t7xx_dev->pdev->dev.kobj,
			   &t7xx_mode_attribute_group);
err_md_exit:
	t7xx_md_exit(t7xx_dev);
	return ret;

The reason that I as for this more idiomatic form is that,
in my experience, it is less error prone and easier
to maintain.

> +
>  	ret = t7xx_interrupt_init(t7xx_dev);
>  	if (ret) {
> +		sysfs_remove_group(&t7xx_dev->pdev->dev.kobj,
> +				   &t7xx_mode_attribute_group);
>  		t7xx_md_exit(t7xx_dev);
>  		return ret;
>  	}

  reply	other threads:[~2023-12-21 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21  7:09 [PATCH v1] net: wwan: t7xx: Add fastboot interface Jinjian Song
2023-12-21 17:53 ` Simon Horman [this message]
2023-12-23  1:50   ` Jinjian Song

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=20231221175332.GD1202958@kernel.org \
    --to=horms@kernel.org \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chiranjeevi.rapolu@linux.intel.com \
    --cc=danielwinkler@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=felix.yan@fibocom.com \
    --cc=haijun.liu@mediatek.com \
    --cc=jinjian.song@fibocom.com \
    --cc=joey.zhao@fibocom.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.com \
    --cc=liuqf@fibocom.com \
    --cc=loic.poulain@linaro.org \
    --cc=m.chetan.kumar@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nmarupaka@google.com \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=songjinjian@hotmail.com \
    --cc=vsankar@lenovo.com \
    /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;
as well as URLs for NNTP newsgroup(s).