All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: cxl: Move a deference below a NULL test
@ 2018-09-26 11:41 zhong jiang
  2018-09-26 23:46 ` Andrew Donnellan
  2018-10-02 22:55 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: zhong jiang @ 2018-09-26 11:41 UTC (permalink / raw)
  To: gregkh; +Cc: fbarrat, andrew.donnellan, arnd, linux-kernel

It is safe to move a deference below a NULL test.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/misc/cxl/guest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index 3bc0c15..559e835 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
 
 void cxl_guest_remove_afu(struct cxl_afu *afu)
 {
-	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
-
 	if (!afu)
 		return;
 
+	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
+
 	/* flush and stop pending job */
 	afu->guest->handle_err = false;
 	flush_delayed_work(&afu->guest->work_err);
-- 
1.7.12.4


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

* Re: [PATCH] misc: cxl: Move a deference below a NULL test
  2018-09-26 11:41 [PATCH] misc: cxl: Move a deference below a NULL test zhong jiang
@ 2018-09-26 23:46 ` Andrew Donnellan
  2018-10-02 22:55 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Donnellan @ 2018-09-26 23:46 UTC (permalink / raw)
  To: zhong jiang, gregkh; +Cc: fbarrat, arnd, linux-kernel

On 26/9/18 9:41 pm, zhong jiang wrote:
> It is safe to move a deference below a NULL test.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Thanks for catching this.

Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

> ---
>   drivers/misc/cxl/guest.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index 3bc0c15..559e835 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
>   
>   void cxl_guest_remove_afu(struct cxl_afu *afu)
>   {
> -	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> -
>   	if (!afu)
>   		return;
>   
> +	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> +
>   	/* flush and stop pending job */
>   	afu->guest->handle_err = false;
>   	flush_delayed_work(&afu->guest->work_err);
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited


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

* Re: [PATCH] misc: cxl: Move a deference below a NULL test
  2018-09-26 11:41 [PATCH] misc: cxl: Move a deference below a NULL test zhong jiang
  2018-09-26 23:46 ` Andrew Donnellan
@ 2018-10-02 22:55 ` Greg KH
  2018-10-04  2:45   ` zhong jiang
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2018-10-02 22:55 UTC (permalink / raw)
  To: zhong jiang; +Cc: fbarrat, andrew.donnellan, arnd, linux-kernel

On Wed, Sep 26, 2018 at 07:41:12PM +0800, zhong jiang wrote:
> It is safe to move a deference below a NULL test.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
>  drivers/misc/cxl/guest.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index 3bc0c15..559e835 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
>  
>  void cxl_guest_remove_afu(struct cxl_afu *afu)
>  {
> -	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> -
>  	if (!afu)
>  		return;
>  
> +	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> +

This call should just be deleted, ftrace can be used if this type of
thing is really needed.

thanks,

greg k-h

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

* Re: [PATCH] misc: cxl: Move a deference below a NULL test
  2018-10-02 22:55 ` Greg KH
@ 2018-10-04  2:45   ` zhong jiang
  0 siblings, 0 replies; 4+ messages in thread
From: zhong jiang @ 2018-10-04  2:45 UTC (permalink / raw)
  To: Greg KH; +Cc: fbarrat, andrew.donnellan, arnd, linux-kernel

On 2018/10/3 6:55, Greg KH wrote:
> On Wed, Sep 26, 2018 at 07:41:12PM +0800, zhong jiang wrote:
>> It is safe to move a deference below a NULL test.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
>> ---
>>  drivers/misc/cxl/guest.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
>> index 3bc0c15..559e835 100644
>> --- a/drivers/misc/cxl/guest.c
>> +++ b/drivers/misc/cxl/guest.c
>> @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
>>  
>>  void cxl_guest_remove_afu(struct cxl_afu *afu)
>>  {
>> -	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
>> -
>>  	if (!afu)
>>  		return;
>>  
>> +	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
>> +
> This call should just be deleted, ftrace can be used if this type of
> thing is really needed.
Ok, just delete the dereference in advance.  Will repost in v2.

Thanks,
zhong jiang
> thanks,
>
> greg k-h
>
> .
>



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

end of thread, other threads:[~2018-10-04  2:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 11:41 [PATCH] misc: cxl: Move a deference below a NULL test zhong jiang
2018-09-26 23:46 ` Andrew Donnellan
2018-10-02 22:55 ` Greg KH
2018-10-04  2:45   ` zhong jiang

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.