public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: replace comparison to NULL by bool
@ 2021-04-09 23:46 Mitali Borkar
  2021-04-10 12:08 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Mitali Borkar @ 2021-04-09 23:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, outreachy-kernel, mitali_s

Fixed Comparison to NULL can be written as '!...' by replacing it with
simpler form i.e boolean expression. This makes code more readable alternative.
Reported by checkpatch.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index 65eac33aaa5b..476875125e87 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
 {
 	u8	count;
 
-	if (pTsCommonInfo == NULL)
+	if (!pTsCommonInfo)
 		return;
 
 	memcpy(pTsCommonInfo->Addr, Addr, 6);
 
-	if (pTSPEC != NULL)
+	if (pTSPEC)
 		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
 		       sizeof(union tspec_body));
 
@@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	}
 
 	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
-	if (*ppTS != NULL)
+	if (ppTS)
 		return true;
 
 	if (!bAddNewTs) {
-- 
2.30.2


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

* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: replace comparison to NULL by bool
  2021-04-09 23:46 [PATCH] staging: rtl8192e: replace comparison to NULL by bool Mitali Borkar
@ 2021-04-10 12:08 ` Julia Lawall
  2021-04-10 12:10   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2021-04-10 12:08 UTC (permalink / raw)
  To: Mitali Borkar
  Cc: gregkh, linux-staging, linux-kernel, outreachy-kernel, mitali_s



On Sat, 10 Apr 2021, Mitali Borkar wrote:

> Fixed Comparison to NULL can be written as '!...' by replacing it with
> simpler form i.e boolean expression. This makes code more readable alternative.
> Reported by checkpatch.
>
> Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> index 65eac33aaa5b..476875125e87 100644
> --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
> +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> @@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
>  {
>  	u8	count;
>
> -	if (pTsCommonInfo == NULL)
> +	if (!pTsCommonInfo)
>  		return;
>
>  	memcpy(pTsCommonInfo->Addr, Addr, 6);
>
> -	if (pTSPEC != NULL)
> +	if (pTSPEC)
>  		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
>  		       sizeof(union tspec_body));
>
> @@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
>  	}
>
>  	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
> -	if (*ppTS != NULL)
> +	if (ppTS)

You lost a * here.

julia

>  		return true;
>
>  	if (!bAddNewTs) {
> --
> 2.30.2
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/YHDnWpWztxeZospi%40kali.
>

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

* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: replace comparison to NULL by bool
  2021-04-10 12:08 ` [Outreachy kernel] " Julia Lawall
@ 2021-04-10 12:10   ` Greg KH
  2021-04-10 12:34     ` Mitali Borkar
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2021-04-10 12:10 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Mitali Borkar, linux-staging, linux-kernel, outreachy-kernel,
	mitali_s

On Sat, Apr 10, 2021 at 02:08:30PM +0200, Julia Lawall wrote:
> 
> 
> On Sat, 10 Apr 2021, Mitali Borkar wrote:
> 
> > Fixed Comparison to NULL can be written as '!...' by replacing it with
> > simpler form i.e boolean expression. This makes code more readable alternative.
> > Reported by checkpatch.
> >
> > Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
> > ---
> >  drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> > index 65eac33aaa5b..476875125e87 100644
> > --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
> > +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> > @@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
> >  {
> >  	u8	count;
> >
> > -	if (pTsCommonInfo == NULL)
> > +	if (!pTsCommonInfo)
> >  		return;
> >
> >  	memcpy(pTsCommonInfo->Addr, Addr, 6);
> >
> > -	if (pTSPEC != NULL)
> > +	if (pTSPEC)
> >  		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
> >  		       sizeof(union tspec_body));
> >
> > @@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
> >  	}
> >
> >  	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
> > -	if (*ppTS != NULL)
> > +	if (ppTS)
> 
> You lost a * here.

Ugh, good catch.

Mitali, can you send me a fix-up patch for this, or do you want me to
drop your original patch from my tree?

thanks,

greg k-h

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

* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: replace comparison to NULL by bool
  2021-04-10 12:10   ` Greg KH
@ 2021-04-10 12:34     ` Mitali Borkar
  0 siblings, 0 replies; 5+ messages in thread
From: Mitali Borkar @ 2021-04-10 12:34 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-staging, linux-kernel, outreachy-kernel, mitali_s

On Sat, Apr 10, 2021 at 02:10:38PM +0200, Greg KH wrote:
> On Sat, Apr 10, 2021 at 02:08:30PM +0200, Julia Lawall wrote:
> > 
> > 
> > On Sat, 10 Apr 2021, Mitali Borkar wrote:
> > 
> > > Fixed Comparison to NULL can be written as '!...' by replacing it with
> > > simpler form i.e boolean expression. This makes code more readable alternative.
> > > Reported by checkpatch.
> > >
> > > Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
> > > ---
> > >  drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> > > index 65eac33aaa5b..476875125e87 100644
> > > --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
> > > +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> > > @@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
> > >  {
> > >  	u8	count;
> > >
> > > -	if (pTsCommonInfo == NULL)
> > > +	if (!pTsCommonInfo)
> > >  		return;
> > >
> > >  	memcpy(pTsCommonInfo->Addr, Addr, 6);
> > >
> > > -	if (pTSPEC != NULL)
> > > +	if (pTSPEC)
> > >  		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
> > >  		       sizeof(union tspec_body));
> > >
> > > @@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
> > >  	}
> > >
> > >  	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
> > > -	if (*ppTS != NULL)
> > > +	if (ppTS)
> > 
> > You lost a * here.
> 
> Ugh, good catch.
> 
> Mitali, can you send me a fix-up patch for this, or do you want me to
> drop your original patch from my tree?
>
Yes Sir, I am making corrections right now in this patch. Will send the
fix up patch in an hour.


> thanks,
> 
> greg k-h

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

* [PATCH] staging: rtl8192e: replace comparison to NULL by bool
@ 2021-04-30 12:56 zhaoxiao
  0 siblings, 0 replies; 5+ messages in thread
From: zhaoxiao @ 2021-04-30 12:56 UTC (permalink / raw)
  To: gregkh, john.oldman, eduard.vintila47
  Cc: will+git, dan.carpenter, mitaliborkar810, linux-staging,
	linux-kernel, zhaoxiao

Fixed Comparison to NULL can be written as '!...' by replacing it with
simpler form i.e boolean expression. This makes code more readable alternative.
Reported by checkpatch.

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/staging/rtl8192e/rtl819x_HTProc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index 48d28c7d870b..3b8efaf9b88c 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -276,7 +276,7 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
 	struct rt_hi_throughput *pHT = ieee->pHTInfo;
 	struct ht_capab_ele *pCapELE = NULL;
 
-	if ((posHTCap == NULL) || (pHT == NULL)) {
+	if (!posHTCap || !pHT) {
 		netdev_warn(ieee->dev,
 			    "%s(): posHTCap and pHTInfo are null\n", __func__);
 		return;
@@ -357,7 +357,7 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,
 	struct rt_hi_throughput *pHT = ieee->pHTInfo;
 	struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo;
 
-	if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
+	if (!posHTInfo || !pHTInfoEle) {
 		netdev_warn(ieee->dev,
 			    "%s(): posHTInfo and pHTInfoEle are null\n",
 			    __func__);
@@ -397,7 +397,7 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,
 void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg,
 				u8 *len)
 {
-	if (posRT2RTAgg == NULL) {
+	if (!posRT2RTAgg) {
 		netdev_warn(ieee->dev, "%s(): posRT2RTAgg is null\n", __func__);
 		return;
 	}
@@ -420,7 +420,7 @@ static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS)
 {
 	u8 i;
 
-	if (pOperateMCS == NULL) {
+	if (!pOperateMCS) {
 		netdev_warn(ieee->dev, "%s(): pOperateMCS is null\n", __func__);
 		return false;
 	}
@@ -453,7 +453,7 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
 	u8		mcsRate = 0;
 	u8		availableMcsRate[16];
 
-	if (pMCSRateSet == NULL || pMCSFilter == NULL) {
+	if (!pMCSRateSet || !pMCSFilter) {
 		netdev_warn(ieee->dev,
 			    "%s(): pMCSRateSet and pMCSFilter are null\n",
 			    __func__);
-- 
2.20.1




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

end of thread, other threads:[~2021-04-30 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-09 23:46 [PATCH] staging: rtl8192e: replace comparison to NULL by bool Mitali Borkar
2021-04-10 12:08 ` [Outreachy kernel] " Julia Lawall
2021-04-10 12:10   ` Greg KH
2021-04-10 12:34     ` Mitali Borkar
  -- strict thread matches above, loose matches on Subject: below --
2021-04-30 12:56 zhaoxiao

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