lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190513224046.GH16162@xps15>
Date:   Mon, 13 May 2019 16:40:46 -0600
From:   Mathieu Poirier <mathieu.poirier@...aro.org>
To:     Suzuki K Poulose <suzuki.poulose@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        coresight@...ts.linaro.org, rjw@...ysocki.net
Subject: Re: [PATCH v3 23/30] coresight: Add support for releasing platform
 specific data

On Tue, May 07, 2019 at 11:52:50AM +0100, Suzuki K Poulose wrote:
> Add a helper to clean up the platform specific data provided
> by the firmware. This will be later used for dropping the necessary
> references when we switch to the fwnode handles for tracking
> connections.
> 
> Cc: Mathieu Poirier <mathieu.poirier@...aro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
> ---
>  drivers/hwtracing/coresight/coresight-platform.c | 6 +++++-
>  drivers/hwtracing/coresight/coresight-priv.h     | 4 ++++
>  drivers/hwtracing/coresight/coresight.c          | 3 +++
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index f500de6..53d6eed 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -17,6 +17,7 @@
>  #include <linux/cpumask.h>
>  #include <asm/smp_plat.h>
>  
> +#include "coresight-priv.h"
>  /*
>   * coresight_alloc_conns: Allocate connections record for each output
>   * port from the device.
> @@ -311,7 +312,7 @@ struct coresight_platform_data *
>  coresight_get_platform_data(struct device *dev)
>  {
>  	int ret = -ENOENT;
> -	struct coresight_platform_data *pdata;
> +	struct coresight_platform_data *pdata = NULL;
>  	struct fwnode_handle *fwnode = dev_fwnode(dev);
>  
>  	if (IS_ERR_OR_NULL(fwnode))
> @@ -329,6 +330,9 @@ coresight_get_platform_data(struct device *dev)
>  	if (!ret)
>  		return pdata;
>  error:
> +	if (!IS_ERR_OR_NULL(pdata))
> +		/* Cleanup the connection information */
> +		coresight_release_platform_data(pdata);
>  	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(coresight_get_platform_data);
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
> index e0684d0..c216421 100644
> --- a/drivers/hwtracing/coresight/coresight-priv.h
> +++ b/drivers/hwtracing/coresight/coresight-priv.h
> @@ -200,4 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id)
>  	return 0;
>  }
>  
> +static inline void
> +coresight_release_platform_data(struct coresight_platform_data *pdata)
> +{}
> +
>  #endif
> diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
> index 96e1515..526141c 100644
> --- a/drivers/hwtracing/coresight/coresight.c
> +++ b/drivers/hwtracing/coresight/coresight.c
> @@ -1250,6 +1250,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
>  err_free_csdev:
>  	kfree(csdev);
>  err_out:
> +	/* Cleanup the connection information */
> +	coresight_release_platform_data(desc->pdata);
>  	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(coresight_register);
> @@ -1259,6 +1261,7 @@ void coresight_unregister(struct coresight_device *csdev)
>  	etm_perf_del_symlink_sink(csdev);
>  	/* Remove references of that device in the topology */
>  	coresight_remove_conns(csdev);
> +	coresight_release_platform_data(csdev->pdata);
>  	device_unregister(&csdev->dev);
>  }
>  EXPORT_SYMBOL_GPL(coresight_unregister);

Reviewed-by: Mathieu Poirier <mathieu.poirier@...aro.org>

> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ