diff mbox series

PCI: Remove redundant initialization of variable rc

Message ID 20210910161417.91001-1-colin.king@canonical.com
State New
Headers show
Series PCI: Remove redundant initialization of variable rc | expand

Commit Message

Colin Ian King Sept. 10, 2021, 4:14 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable rc is being initialized with a value that is never read, it
is being updated later on. The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Krzysztof Wilczy��ski Sept. 15, 2021, 1:23 a.m. UTC | #1
Hi Colin,

> The variable rc is being initialized with a value that is never read, it
> is being updated later on. The assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ce2ab62b64cf..cd8cb94cc450 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5288,7 +5288,7 @@ const struct attribute_group pci_dev_reset_method_attr_group = {
>   */
>  int __pci_reset_function_locked(struct pci_dev *dev)
>  {
> -	int i, m, rc = -ENOTTY;
> +	int i, m, rc;

Thank you!

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

	Krzysztof
Bjorn Helgaas Oct. 26, 2021, 9:35 p.m. UTC | #2
On Fri, Sep 10, 2021 at 05:14:17PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable rc is being initialized with a value that is never read, it
> is being updated later on. The assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied with Krzysztof's reviewed-by to pci/misc for v5.16, thanks!

> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ce2ab62b64cf..cd8cb94cc450 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5288,7 +5288,7 @@ const struct attribute_group pci_dev_reset_method_attr_group = {
>   */
>  int __pci_reset_function_locked(struct pci_dev *dev)
>  {
> -	int i, m, rc = -ENOTTY;
> +	int i, m, rc;
>  
>  	might_sleep();
>  
> -- 
> 2.32.0
>
diff mbox series

Patch

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ce2ab62b64cf..cd8cb94cc450 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5288,7 +5288,7 @@  const struct attribute_group pci_dev_reset_method_attr_group = {
  */
 int __pci_reset_function_locked(struct pci_dev *dev)
 {
-	int i, m, rc = -ENOTTY;
+	int i, m, rc;
 
 	might_sleep();