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] [thread-next>] [day] [month] [year] [list]
Message-ID: <54e034aa-4012-e6f1-c0f3-325d8fe0f4c1@arm.com>
Date:   Fri, 2 Sep 2022 14:03:07 +0100
From:   James Clark <james.clark@....com>
To:     Nathan Chancellor <nathan@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Suzuki K Poulose <suzuki.poulose@....com>
Cc:     Mike Leach <mike.leach@...aro.org>, Leo Yan <leo.yan@...aro.org>,
        coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as
 __maybe_unused



On 01/09/2022 20:50, Nathan Chancellor wrote:
> When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a
> warning about coresight_cti_reg_store() being unused in the file:
> 
>   drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function]
>     184 | static ssize_t coresight_cti_reg_store(struct device *dev,
>         |                ^~~~~~~~~~~~~~~~~~~~~~~
> 
> This is expected as coresight_cti_reg_store() is only used in the
> coresight_cti_reg_rw macro, which is only used in a block guarded by
> CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as
> __maybe_unused to clearly indicate that the function may be unused
> depending on the configuration.

It would also be possible to fix this by wrapping the definitions in
#ifdef CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. That way the maybe_unused
isn't needed and it's a bit cleaner.

Either way, thanks for the fix.

Reviewed-by: James Clark <james.clark@....com>

> 
> Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors")
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
>  drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> index 478b8d38b744..6d59c815ecf5 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> @@ -181,9 +181,9 @@ static ssize_t coresight_cti_reg_show(struct device *dev,
>  }
>  
>  /* Write registers with power check only (no enable check). */
> -static ssize_t coresight_cti_reg_store(struct device *dev,
> -				       struct device_attribute *attr,
> -				       const char *buf, size_t size)
> +static __maybe_unused ssize_t coresight_cti_reg_store(struct device *dev,
> +						      struct device_attribute *attr,
> +						      const char *buf, size_t size)
>  {
>  	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
>  	struct cs_off_attribute *cti_attr = container_of(attr, struct cs_off_attribute, attr);
> 
> base-commit: 0a98181f805058773961c5ab3172ecf1bf1ed0e1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ