linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][V2] intel_th: remove redundant re-assignment of pointer hubdrv
@ 2021-12-07 23:07 Colin Ian King
  2021-12-08 10:02 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2021-12-07 23:07 UTC (permalink / raw)
  To: Alexander Shishkin; +Cc: kernel-janitors, linux-kernel, Dan Carpenter

The pointer hubdrv is being re-assigned the same value as it was
initialized with only a few lines earlier. The re-assignment is
redundant and can be removed.

As Dan Carpenter pointed out, the pointer hubdrv is hub - some_offset
and in this case some_offset is zero. Since hub has already been
dereferenced hubdrv can't be NULL so the NULL check is redundant
and can also be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

---

V2: Remove null check, kudos to Dan Carpenter for spotting this.

---
 drivers/hwtracing/intel_th/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 7e753a75d23b..bf4ee2a31006 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -1048,8 +1048,7 @@ int intel_th_set_output(struct intel_th_device *thdev,
 	 * hub is instantiated together with the source device that
 	 * calls here, so guaranteed to be present.
 	 */
-	hubdrv = to_intel_th_driver(hub->dev.driver);
-	if (!hubdrv || !try_module_get(hubdrv->driver.owner))
+	if (!try_module_get(hubdrv->driver.owner))
 		return -EINVAL;
 
 	if (!hubdrv->set_output) {
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][V2] intel_th: remove redundant re-assignment of pointer hubdrv
  2021-12-07 23:07 [PATCH][V2] intel_th: remove redundant re-assignment of pointer hubdrv Colin Ian King
@ 2021-12-08 10:02 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-12-08 10:02 UTC (permalink / raw)
  To: Colin Ian King; +Cc: Alexander Shishkin, kernel-janitors, linux-kernel

On Tue, Dec 07, 2021 at 11:07:09PM +0000, Colin Ian King wrote:
> The pointer hubdrv is being re-assigned the same value as it was
> initialized with only a few lines earlier. The re-assignment is
> redundant and can be removed.
> 
> As Dan Carpenter pointed out, the pointer hubdrv is hub - some_offset
> and in this case some_offset is zero. Since hub has already been
> dereferenced hubdrv can't be NULL so the NULL check is redundant
> and can also be removed.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> 
> ---

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-08 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 23:07 [PATCH][V2] intel_th: remove redundant re-assignment of pointer hubdrv Colin Ian King
2021-12-08 10:02 ` Dan Carpenter

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).