diff mbox series

Fix le16_to_cpu warning for beacon_interval

Message ID CWLP265MB3217B3A355529E36F6468A43E0FC9@CWLP265MB3217.GBRP265.PROD.OUTLOOK.COM (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series Fix le16_to_cpu warning for beacon_interval | expand

Commit Message

Srinivasan Raju April 29, 2022, 10:20 a.m. UTC
Fixed the following warning
drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: expected unsigned short [usertype] beacon_interval
drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: got restricted __le16 [usertype]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Srinivasan Raju <srini.raju@purelifi.com>
---
 drivers/net/wireless/purelifi/plfxlc/chip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kalle Valo April 29, 2022, 10:25 a.m. UTC | #1
Srinivasan Raju <srini.raju@purelifi.com> writes:

> Fixed the following warning
> drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: expected unsigned short [usertype] beacon_interval
> drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: got restricted __le16 [usertype]

The preferred style is this:

Fix the following sparse warnings:

drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: expected unsigned short [usertype] beacon_interval
drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: got restricted __le16 [usertype]

> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Srinivasan Raju <srini.raju@purelifi.com>
> ---
>  drivers/net/wireless/purelifi/plfxlc/chip.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

The subject should be:

[PATCH] plfxlc: fix le16_to_cpu warning for beacon_interval

> diff --git a/drivers/net/wireless/purelifi/plfxlc/chip.c b/drivers/net/wireless/purelifi/plfxlc/chip.c
> index a5ec10b66ed5..5d952ca07195 100644
> --- a/drivers/net/wireless/purelifi/plfxlc/chip.c
> +++ b/drivers/net/wireless/purelifi/plfxlc/chip.c
> @@ -30,10 +30,10 @@ int plfxlc_set_beacon_interval(struct plfxlc_chip *chip, u16 interval,
>  {
>         if (!interval ||
>             (chip->beacon_set && 
> -            le16_to_cpu(chip->beacon_interval) == interval))
> +            chip->beacon_interval) == interval)
>                 return 0;

I think there's no need to use three lines anymore, two lines should be
enough:

       if (!interval ||
           (chip->beacon_set && chip->beacon_interval == interval))
Julian Calaby April 29, 2022, 11:16 a.m. UTC | #2
Hi Srinivasan,

On Fri, Apr 29, 2022 at 8:49 PM Srinivasan Raju <srini.raju@purelifi.com> wrote:
>
> Fixed the following warning
> drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: expected unsigned short [usertype] beacon_interval
> drivers/net/wireless/purelifi/plfxlc/chip.c:36:31: sparse: got restricted __le16 [usertype]
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Srinivasan Raju <srini.raju@purelifi.com>
> ---
>  drivers/net/wireless/purelifi/plfxlc/chip.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/purelifi/plfxlc/chip.c b/drivers/net/wireless/purelifi/plfxlc/chip.c
> index a5ec10b66ed5..5d952ca07195 100644
> --- a/drivers/net/wireless/purelifi/plfxlc/chip.c
> +++ b/drivers/net/wireless/purelifi/plfxlc/chip.c
> @@ -30,10 +30,10 @@ int plfxlc_set_beacon_interval(struct plfxlc_chip *chip, u16 interval,
>  {
>         if (!interval ||
>             (chip->beacon_set &&
> -            le16_to_cpu(chip->beacon_interval) == interval))
> +            chip->beacon_interval) == interval)

Shouldn't that first ")" go at the end of the line?

Thanks,
diff mbox series

Patch

diff --git a/drivers/net/wireless/purelifi/plfxlc/chip.c b/drivers/net/wireless/purelifi/plfxlc/chip.c
index a5ec10b66ed5..5d952ca07195 100644
--- a/drivers/net/wireless/purelifi/plfxlc/chip.c
+++ b/drivers/net/wireless/purelifi/plfxlc/chip.c
@@ -30,10 +30,10 @@  int plfxlc_set_beacon_interval(struct plfxlc_chip *chip, u16 interval,
 {
        if (!interval ||
            (chip->beacon_set &&
-            le16_to_cpu(chip->beacon_interval) == interval))
+            chip->beacon_interval) == interval)
                return 0;

-       chip->beacon_interval = cpu_to_le16(interval);
+       chip->beacon_interval = interval;
        chip->beacon_set = true;
        return plfxlc_usb_wreq(chip->usb.ez_usb,
                               &chip->beacon_interval,