From: Markus Elfring <Markus.Elfring@web.de>
To: Guangshuo Li <lgs201920130244@gmail.com>,
linux-media@vger.kernel.org, Antti Palosaari <crope@iki.fi>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: stable@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>
Subject: Re: [PATCH v2] media: rtl28xxu: fix SDR platform device leak
Date: Thu, 24 Sep 2026 18:38:10 +0200 [thread overview]
Message-ID: <c5ae1aed-08f1-4ac6-92d5-57b475e56488@web.de> (raw)
In-Reply-To: <20260924135514.1591658-1-lgs201920130244@gmail.com>
…
> +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> @@ -1391,8 +1391,16 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
> "rtl2832_sdr",
> PLATFORM_DEVID_AUTO,
> &pdata, sizeof(pdata));
> - if (IS_ERR(pdev) || pdev->dev.driver == NULL)
> + if (IS_ERR(pdev))
> break;
> + if (!pdev->dev.driver) {
> + platform_device_unregister(pdev);
> + break;
> + }
> + if (!try_module_get(pdev->dev.driver->owner)) {
> + platform_device_unregister(pdev);
> + break;
> + }
…
How do you think about to avoid a bit of duplicate source code
by merging two condition checks into a disjunction?
Regards,
Markus
prev parent reply other threads:[~2026-09-24 16:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 13:55 Guangshuo Li
2026-09-24 16:38 ` Markus Elfring [this message]
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=c5ae1aed-08f1-4ac6-92d5-57b475e56488@web.de \
--to=markus.elfring@web.de \
--cc=crope@iki.fi \
--cc=hverkuil+cisco@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®