* [PATCH v2] ata: pata_via: fix sloppy typing in via_do_set_mode()
@ 2022-04-12 20:39 Sergey Shtylyov
2022-04-13 3:47 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2022-04-12 20:39 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
The local variables 'T' and 'UT' are needlessly declared as *unsigned*
*long* -- the corresponding parameters of ata_timing_compute() are both
declared as *int*. While fixing up those declarations, also make the
'via_clock' and 'T' variables *const* as they are never re-assigned
after initialization -- the object code should remain the same as gcc
previously used copy propagation anyway...
Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
This patch is against the 'for-next' branch of Damien Le Moal's 'libata.git'
repo.
Changes in version 2:
- declared the 'T' and 'UT' variables as *int* instead of *unsigned long*;
- dropped *unsigned* from the 'via_clock' variable declaration;
- updated the patch description.
drivers/ata/pata_via.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: libata/drivers/ata/pata_via.c
===================================================================
--- libata.orig/drivers/ata/pata_via.c
+++ libata/drivers/ata/pata_via.c
@@ -248,9 +248,9 @@ static void via_do_set_mode(struct ata_p
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
struct ata_device *peer = ata_dev_pair(adev);
struct ata_timing t, p;
- static int via_clock = 33333; /* Bus clock in kHZ */
- unsigned long T = 1000000000 / via_clock;
- unsigned long UT = T;
+ const int via_clock = 33333; /* Bus clock in kHz */
+ const int T = 1000000000 / via_clock;
+ int UT = T;
int ut;
int offset = 3 - (2*ap->port_no) - adev->devno;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ata: pata_via: fix sloppy typing in via_do_set_mode()
2022-04-12 20:39 [PATCH v2] ata: pata_via: fix sloppy typing in via_do_set_mode() Sergey Shtylyov
@ 2022-04-13 3:47 ` Damien Le Moal
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-04-13 3:47 UTC (permalink / raw)
To: Sergey Shtylyov, linux-ide
On 4/13/22 05:39, Sergey Shtylyov wrote:
> The local variables 'T' and 'UT' are needlessly declared as *unsigned*
> *long* -- the corresponding parameters of ata_timing_compute() are both
> declared as *int*. While fixing up those declarations, also make the
> 'via_clock' and 'T' variables *const* as they are never re-assigned
> after initialization -- the object code should remain the same as gcc
> previously used copy propagation anyway...
>
> Found by Linux Verification Center (linuxtesting.org) with the SVACE static
> analysis tool.
>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Applied to for-5.19. Thanks !
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-13 3:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 20:39 [PATCH v2] ata: pata_via: fix sloppy typing in via_do_set_mode() Sergey Shtylyov
2022-04-13 3:47 ` Damien Le Moal
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.