linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: st: remove unneeded variable 'result' in st_release()
@ 2020-04-18  7:06 Jason Yan
  2020-04-18  8:24 ` "Kai Mäkisara (Kolumbus)"
  2020-04-22  4:05 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Yan @ 2020-04-18  7:06 UTC (permalink / raw)
  To: Kai.Makisara, jejb, martin.petersen, arnd, linux-scsi, linux-kernel
  Cc: Jason Yan, Hulk Robot

Also remove a strange '^L' after this function.

Fix the following coccicheck warning:

drivers/scsi/st.c:1460:5-11: Unneeded variable: "result". Return "0" on
line 1473

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
 drivers/scsi/st.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index c5f9b348b438..4bf4ab3b70f4 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -1457,7 +1457,6 @@ static int st_flush(struct file *filp, fl_owner_t id)
    accessing this tape. */
 static int st_release(struct inode *inode, struct file *filp)
 {
-	int result = 0;
 	struct scsi_tape *STp = filp->private_data;
 
 	if (STp->door_locked == ST_LOCKED_AUTO)
@@ -1470,9 +1469,9 @@ static int st_release(struct inode *inode, struct file *filp)
 	scsi_autopm_put_device(STp->device);
 	scsi_tape_put(STp);
 
-	return result;
+	return 0;
 }
-\f
+
 /* The checks common to both reading and writing */
 static ssize_t rw_checks(struct scsi_tape *STp, struct file *filp, size_t count)
 {
-- 
2.21.1


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

* Re: [PATCH] scsi: st: remove unneeded variable 'result' in st_release()
  2020-04-18  7:06 [PATCH] scsi: st: remove unneeded variable 'result' in st_release() Jason Yan
@ 2020-04-18  8:24 ` "Kai Mäkisara (Kolumbus)"
  2020-04-22  4:05 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: "Kai Mäkisara (Kolumbus)" @ 2020-04-18  8:24 UTC (permalink / raw)
  To: Jason Yan
  Cc: James E.J. Bottomley, martin.petersen, arnd, linux-scsi,
	linux-kernel, Hulk Robot



> On 18. Apr 2020, at 10.06, Jason Yan <yanaijie@huawei.com> wrote:
> 
> Also remove a strange '^L' after this function.
> 
It is the FormFeed character, put there to make viewing the source easier
(the following functions are helpers). (The FormFeed may not be as
familiar to the younger generations than it is to us who have used line
printers with hammers and drums or chains :-)

> Fix the following coccicheck warning:
> 
> drivers/scsi/st.c:1460:5-11: Unneeded variable: "result". Return "0" on
> line 1473
> 
The variable is related to the style of programming: default the return value
to zero and modify it in the code if necessary. In the current version, there
is no need (may have been at some time).

IMHO, the code checking tools should have some understanding of the
style issues. However, if the common opinion is to remove the variable,
I have to accept that.

Kai

> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>

Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>

> ---
> drivers/scsi/st.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index c5f9b348b438..4bf4ab3b70f4 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -1457,7 +1457,6 @@ static int st_flush(struct file *filp, fl_owner_t id)
>    accessing this tape. */
> static int st_release(struct inode *inode, struct file *filp)
> {
> -	int result = 0;
> 	struct scsi_tape *STp = filp->private_data;
> 
> 	if (STp->door_locked == ST_LOCKED_AUTO)
> @@ -1470,9 +1469,9 @@ static int st_release(struct inode *inode, struct file *filp)
> 	scsi_autopm_put_device(STp->device);
> 	scsi_tape_put(STp);
> 
> -	return result;
> +	return 0;
> }
> -\f
> +
> /* The checks common to both reading and writing */
> static ssize_t rw_checks(struct scsi_tape *STp, struct file *filp, size_t count)
> {
> -- 
> 2.21.1
> 


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

* Re: [PATCH] scsi: st: remove unneeded variable 'result' in st_release()
  2020-04-18  7:06 [PATCH] scsi: st: remove unneeded variable 'result' in st_release() Jason Yan
  2020-04-18  8:24 ` "Kai Mäkisara (Kolumbus)"
@ 2020-04-22  4:05 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-04-22  4:05 UTC (permalink / raw)
  To: Jason Yan
  Cc: Kai.Makisara, jejb, martin.petersen, arnd, linux-scsi,
	linux-kernel, Hulk Robot


Jason,

> Also remove a strange '^L' after this function.
>
> Fix the following coccicheck warning:
>
> drivers/scsi/st.c:1460:5-11: Unneeded variable: "result". Return "0" on
> line 1473

Applied to 5.8/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-04-22  4:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18  7:06 [PATCH] scsi: st: remove unneeded variable 'result' in st_release() Jason Yan
2020-04-18  8:24 ` "Kai Mäkisara (Kolumbus)"
2020-04-22  4:05 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).