public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Richard Cochran <richardcochran@gmail.com>,
	Jonathan Lemon <jonathan.lemon@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v1 2/7] ptp: ocp: Make ptp_ocp_unregister_ext() NULL-aware
Date: Wed, 12 Nov 2025 13:38:44 +0000	[thread overview]
Message-ID: <7d10e9ac-98b1-4a75-a61a-85a59c8efd86@linux.dev> (raw)
In-Reply-To: <20251111165232.1198222-3-andriy.shevchenko@linux.intel.com>

On 11/11/2025 16:52, Andy Shevchenko wrote:
> It's a common practice to make resource release functions be NULL-aware.
> Make ptp_ocp_unregister_ext() NULL-aware.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/ptp/ptp_ocp.c | 24 ++++++++++--------------
>   1 file changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 95889f85ffb2..28243fb1d78f 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -2225,6 +2225,9 @@ ptp_ocp_ts_enable(void *priv, u32 req, bool enable)
>   static void
>   ptp_ocp_unregister_ext(struct ptp_ocp_ext_src *ext)
>   {
> +	if (!ext)
> +		return;
> +
>   	ext->info->enable(ext, ~0, false);
>   	pci_free_irq(ext->bp->pdev, ext->irq_vec, ext);
>   	kfree(ext);
> @@ -4558,21 +4561,14 @@ ptp_ocp_detach(struct ptp_ocp *bp)
>   	ptp_ocp_detach_sysfs(bp);
>   	ptp_ocp_attr_group_del(bp);
>   	timer_delete_sync(&bp->watchdog);
> -	if (bp->ts0)
> -		ptp_ocp_unregister_ext(bp->ts0);
> -	if (bp->ts1)
> -		ptp_ocp_unregister_ext(bp->ts1);
> -	if (bp->ts2)
> -		ptp_ocp_unregister_ext(bp->ts2);
> -	if (bp->ts3)
> -		ptp_ocp_unregister_ext(bp->ts3);
> -	if (bp->ts4)
> -		ptp_ocp_unregister_ext(bp->ts4);
> -	if (bp->pps)
> -		ptp_ocp_unregister_ext(bp->pps);
> +	ptp_ocp_unregister_ext(bp->ts0);
> +	ptp_ocp_unregister_ext(bp->ts1);
> +	ptp_ocp_unregister_ext(bp->ts2);
> +	ptp_ocp_unregister_ext(bp->ts3);
> +	ptp_ocp_unregister_ext(bp->ts4);
> +	ptp_ocp_unregister_ext(bp->pps);
>   	for (i = 0; i < 4; i++)
> -		if (bp->signal_out[i])
> -			ptp_ocp_unregister_ext(bp->signal_out[i]);
> +		ptp_ocp_unregister_ext(bp->signal_out[i]);
>   	for (i = 0; i < __PORT_COUNT; i++)
>   		if (bp->port[i].line != -1)
>   			serial8250_unregister_port(bp->port[i].line);
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2025-11-12 13:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 16:52 [PATCH v1 0/7] ptp: ocp: A fix and refactoring Andy Shevchenko
2025-11-11 16:52 ` [PATCH net-next v1 1/7] ptp: ocp: Refactor signal_show() and fix %ptT misuse Andy Shevchenko
2025-11-12 13:29   ` Vadim Fedorenko
2025-11-11 16:52 ` [PATCH net-next v1 2/7] ptp: ocp: Make ptp_ocp_unregister_ext() NULL-aware Andy Shevchenko
2025-11-12 13:38   ` Vadim Fedorenko [this message]
2025-11-11 16:52 ` [PATCH net-next v1 3/7] ptp: ocp: Refactor ptp_ocp_i2c_notifier_call() Andy Shevchenko
2025-11-12 13:45   ` Vadim Fedorenko
2025-11-12 15:04     ` Andy Shevchenko
2025-11-11 16:52 ` [PATCH net-next v1 4/7] ptp: ocp: Apply standard pattern for cleaning up loop Andy Shevchenko
2025-11-12 13:36   ` Vadim Fedorenko
2025-11-11 16:52 ` [PATCH net-next v1 5/7] ptp: ocp: Reuse META's PCI vendor ID Andy Shevchenko
2025-11-12 13:37   ` Vadim Fedorenko
2025-11-11 16:52 ` [PATCH net-next v1 6/7] ptp: ocp: Sort headers alphabetically Andy Shevchenko
2025-11-11 16:52 ` [PATCH net-next v1 7/7] ptp: ocp: don't use "proxy" headers Andy Shevchenko
2025-11-12 15:27 ` [PATCH v1 0/7] ptp: ocp: A fix and refactoring Vadim Fedorenko

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=7d10e9ac-98b1-4a75-a61a-85a59c8efd86@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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