Skip to content

Commit

Permalink
ata: libata: ata_{sff|std}_prereset() always return 0
Browse files Browse the repository at this point in the history
ata_std_prereset() always returns 0, hence the check in ata_sff_prereset()
is pointless and thus it also can return only 0 (however, we cannot change
the prototypes of ata_{sff|std}_prereset() as they implement the driver's
prereset() method).

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
  • Loading branch information
Sergey Shtylyov authored and Damien Le Moal committed Feb 3, 2022
1 parent f4a8d4f commit ac1eb66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3568,7 +3568,7 @@ EXPORT_SYMBOL_GPL(ata_wait_after_reset);
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, -errno otherwise.
* Always 0.
*/
int ata_std_prereset(struct ata_link *link, unsigned long deadline)
{
Expand Down
7 changes: 3 additions & 4 deletions drivers/ata/libata-sff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1708,16 +1708,15 @@ EXPORT_SYMBOL_GPL(ata_sff_thaw);
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, -errno otherwise.
* Always 0.
*/
int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
{
struct ata_eh_context *ehc = &link->eh_context;
int rc;

rc = ata_std_prereset(link, deadline);
if (rc)
return rc;
/* The standard prereset is best-effort and always returns 0 */
ata_std_prereset(link, deadline);

/* if we're about to do hardreset, nothing more to do */
if (ehc->i.action & ATA_EH_HARDRESET)
Expand Down

0 comments on commit ac1eb66

Please sign in to comment.