Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1601548 > unrolled thread

[PATCH] [SCSI] esas2r: remove redundant NULL check on buffer

Started byColin King <colin.king@canonical.com>
First post2017-03-15 17:50 +0100
Last post2017-03-17 01:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [SCSI] esas2r: remove redundant NULL check on buffer Colin King <colin.king@canonical.com> - 2017-03-15 17:50 +0100
    Re: [PATCH] [SCSI] esas2r: remove redundant NULL check on buffer Bradley Grove <bgrove@attotech.com> - 2017-03-16 23:50 +0100
    Re: [PATCH] [SCSI] esas2r: remove redundant NULL check on buffer "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-17 01:00 +0100

#1601548 — [PATCH] [SCSI] esas2r: remove redundant NULL check on buffer

FromColin King <colin.king@canonical.com>
Date2017-03-15 17:50 +0100
Subject[PATCH] [SCSI] esas2r: remove redundant NULL check on buffer
Message-ID<tlkhA-1Qf-25@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

buffer is a pointer to the static char array event_buffer and
therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1077556 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/esas2r/esas2r_log.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r_log.c b/drivers/scsi/esas2r/esas2r_log.c
index a82030a..65fdf22 100644
--- a/drivers/scsi/esas2r/esas2r_log.c
+++ b/drivers/scsi/esas2r/esas2r_log.c
@@ -130,11 +130,6 @@ static int esas2r_log_master(const long level,
 
 		spin_lock_irqsave(&event_buffer_lock, flags);
 
-		if (buffer == NULL) {
-			spin_unlock_irqrestore(&event_buffer_lock, flags);
-			return -1;
-		}
-
 		memset(buffer, 0, buflen);
 
 		/*
-- 
2.10.2

[toc] | [next] | [standalone]


#1602899

FromBradley Grove <bgrove@attotech.com>
Date2017-03-16 23:50 +0100
Message-ID<tlMnw-51X-19@gated-at.bofh.it>
In reply to#1601548
On 03/15/2017 12:46 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> buffer is a pointer to the static char array event_buffer and
> therefore can never be null, so the check is redundant. Remove it.
>
> Detected by CoverityScan, CID#1077556 ("Logically Dead Code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/esas2r/esas2r_log.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/drivers/scsi/esas2r/esas2r_log.c b/drivers/scsi/esas2r/esas2r_log.c
> index a82030a..65fdf22 100644
> --- a/drivers/scsi/esas2r/esas2r_log.c
> +++ b/drivers/scsi/esas2r/esas2r_log.c
> @@ -130,11 +130,6 @@ static int esas2r_log_master(const long level,
>
>  		spin_lock_irqsave(&event_buffer_lock, flags);
>
> -		if (buffer == NULL) {
> -			spin_unlock_irqrestore(&event_buffer_lock, flags);
> -			return -1;
> -		}
> -
>  		memset(buffer, 0, buflen);
>
>  		/*
>

Thanks,

Acked-by: Bradley Grove <bgrove@attotech.com>



This electronic transmission and any attachments hereto are intended only for the use of the individual or entity to which it is addressed and may contain confidential information belonging to ATTO Technology, Inc. If you have reason to believe that you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this electronic transmission is strictly prohibited. If you have reason to believe that you have received this transmission in error, please notify ATTO immediately by return e-mail and delete and destroy this communication.   

[toc] | [prev] | [next] | [standalone]


#1602921

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-03-17 01:00 +0100
Message-ID<tlNtf-5KZ-7@gated-at.bofh.it>
In reply to#1601548
Colin King <colin.king@canonical.com> writes:

> buffer is a pointer to the static char array event_buffer and
> therefore can never be null, so the check is redundant. Remove it.

Applied to 4.12/scsi-queue. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web