public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: pi433: fix check for FDEVMSB register mask
@ 2017-08-13 19:43 Frederico Cadete
  2017-08-15  0:57 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Frederico Cadete @ 2017-08-13 19:43 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: linux, Frederico Cadete

The code was using the logical negation operator "!", effectively never
triggering the error path. To check the bitmask we should use the
bitwise negation "~".

Cleans up sparse warning:
  warning: dubious: x & !y

Signed-off-by: Frederico Cadete <frederico@cadete.eu>
---
 drivers/staging/pi433/rf69.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index f83523e3395d..e6332e1297ae 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -203,7 +203,7 @@ int rf69_set_deviation(struct spi_device *spi, u32 deviation)
 	lsb = (f_reg&0xff);
 
 	// check msb
-	if (msb & !FDEVMASB_MASK)
+	if (msb & ~FDEVMASB_MASK)
 	{
 		dev_dbg(&spi->dev, "set_deviation: err in calc of msb");
 		INVALID_PARAM;
-- 
2.14.1

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

* Re: [PATCH] staging: pi433: fix check for FDEVMSB register mask
  2017-08-13 19:43 [PATCH] staging: pi433: fix check for FDEVMSB register mask Frederico Cadete
@ 2017-08-15  0:57 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-08-15  0:57 UTC (permalink / raw)
  To: Frederico Cadete; +Cc: linux-kernel, linux

On Sun, Aug 13, 2017 at 09:43:50PM +0200, Frederico Cadete wrote:
> The code was using the logical negation operator "!", effectively never
> triggering the error path. To check the bitmask we should use the
> bitwise negation "~".
> 
> Cleans up sparse warning:
>   warning: dubious: x & !y
> 
> Signed-off-by: Frederico Cadete <frederico@cadete.eu>
> ---
>  drivers/staging/pi433/rf69.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Does not apply to my tree :(

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

end of thread, other threads:[~2017-08-15  0:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-13 19:43 [PATCH] staging: pi433: fix check for FDEVMSB register mask Frederico Cadete
2017-08-15  0:57 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox