All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c
@ 2021-06-12 23:28 Phillip Potter
  2021-06-13  0:22 ` Joe Perches
  2021-06-14 12:10 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Phillip Potter @ 2021-06-12 23:28 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, linux, straube.linux, martin, linux-staging, linux-kernel

Convert both calls to the DBG_88E macro in core/rtw_sta_mgt.c into
netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
debug messages can be controlled more precisely by just using debugfs.
It is important to keep these messages still, as they are displayable
via a kernel module parameter when using DBG_88E.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 5af7af5f5a5a..ad1d851a2f69 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -113,17 +113,20 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
 inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
 {
 	int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
+	struct net_device *pnetdev = stapriv->padapter->pnetdev;
 
 	if (!stainfo_offset_valid(offset))
-		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
+		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);
 
 	return offset;
 }
 
 inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
 {
+	struct net_device *pnetdev = stapriv->padapter->pnetdev;
+
 	if (!stainfo_offset_valid(offset))
-		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
+		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);
 
 	return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
 }
-- 
2.30.2


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

* Re: [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c
  2021-06-12 23:28 [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c Phillip Potter
@ 2021-06-13  0:22 ` Joe Perches
  2021-06-13 10:12   ` Phillip Potter
  2021-06-14 12:10 ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2021-06-13  0:22 UTC (permalink / raw)
  To: Phillip Potter, gregkh
  Cc: Larry.Finger, linux, straube.linux, martin, linux-staging, linux-kernel

On Sun, 2021-06-13 at 00:28 +0100, Phillip Potter wrote:
> Convert both calls to the DBG_88E macro in core/rtw_sta_mgt.c into
> netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> debug messages can be controlled more precisely by just using debugfs.
> It is important to keep these messages still, as they are displayable
> via a kernel module parameter when using DBG_88E.
[]
> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
[]
> @@ -113,17 +113,20 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
>  inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
>  {
>  	int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
> +	struct net_device *pnetdev = stapriv->padapter->pnetdev;
>  
> 
>  	if (!stainfo_offset_valid(offset))
> -		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
> +		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);

better to add terminating newlines to the formats.



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

* Re: [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c
  2021-06-13  0:22 ` Joe Perches
@ 2021-06-13 10:12   ` Phillip Potter
  0 siblings, 0 replies; 4+ messages in thread
From: Phillip Potter @ 2021-06-13 10:12 UTC (permalink / raw)
  To: Joe Perches
  Cc: gregkh, Larry.Finger, linux, straube.linux, martin,
	linux-staging, linux-kernel

On Sat, Jun 12, 2021 at 05:22:33PM -0700, Joe Perches wrote:
> On Sun, 2021-06-13 at 00:28 +0100, Phillip Potter wrote:
> > Convert both calls to the DBG_88E macro in core/rtw_sta_mgt.c into
> > netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> > debug messages can be controlled more precisely by just using debugfs.
> > It is important to keep these messages still, as they are displayable
> > via a kernel module parameter when using DBG_88E.
> []
> > diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> []
> > @@ -113,17 +113,20 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
> >  inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
> >  {
> >  	int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
> > +	struct net_device *pnetdev = stapriv->padapter->pnetdev;
> >  
> > 
> >  	if (!stainfo_offset_valid(offset))
> > -		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
> > +		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);
> 
> better to add terminating newlines to the formats.
> 
> 
Dear Joe,

Thank you for your feedback. I will republish my two patches with this
change.

Regards,
Phil

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

* Re: [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c
  2021-06-12 23:28 [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c Phillip Potter
  2021-06-13  0:22 ` Joe Perches
@ 2021-06-14 12:10 ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-06-14 12:10 UTC (permalink / raw)
  To: Phillip Potter
  Cc: gregkh, Larry.Finger, linux, straube.linux, martin,
	linux-staging, linux-kernel

On Sun, Jun 13, 2021 at 12:28:31AM +0100, Phillip Potter wrote:
> Convert both calls to the DBG_88E macro in core/rtw_sta_mgt.c into
> netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> debug messages can be controlled more precisely by just using debugfs.
> It is important to keep these messages still, as they are displayable
> via a kernel module parameter when using DBG_88E.
> 
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
>  drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> index 5af7af5f5a5a..ad1d851a2f69 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> @@ -113,17 +113,20 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
>  inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
>  {
>  	int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
> +	struct net_device *pnetdev = stapriv->padapter->pnetdev;
>  
>  	if (!stainfo_offset_valid(offset))
> -		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
> +		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);
>  
>  	return offset;
>  }
>  
>  inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
>  {
> +	struct net_device *pnetdev = stapriv->padapter->pnetdev;
> +
>  	if (!stainfo_offset_valid(offset))
> -		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
> +		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);

This should be an error and the code should handle it correctly instead
of reading beyond the end of the struct.

regards,
dan carpenter


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

end of thread, other threads:[~2021-06-14 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-12 23:28 [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c Phillip Potter
2021-06-13  0:22 ` Joe Perches
2021-06-13 10:12   ` Phillip Potter
2021-06-14 12:10 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.