diff mbox series

[v2,1/2] PCI/VPD: Remove dead code from sysfs access functions

Message ID 267eae86-f8a6-6792-a7f8-2c4fd51beedc@gmail.com (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series PCI/VPD: Improve handling binary sysfs attribute | expand

Commit Message

Heiner Kallweit Feb. 3, 2021, 8:48 a.m. UTC
Since 104daa71b396 ("PCI: Determine actual VPD size on first access")
attribute size is set to 0 (unlimited). So let's remove this now
dead code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- no changes
---
 drivers/pci/vpd.c | 14 --------------
 1 file changed, 14 deletions(-)

Comments

Krzysztof Wilczyński Feb. 3, 2021, 3:22 p.m. UTC | #1
Hi Heiner,

Thank you for cleaning this up!

On 21-02-03 09:48:03, Heiner Kallweit wrote:
> Since 104daa71b396 ("PCI: Determine actual VPD size on first access")
> attribute size is set to 0 (unlimited). So let's remove this now
> dead code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> v2:
> - no changes
> ---
>  drivers/pci/vpd.c | 14 --------------
>  1 file changed, 14 deletions(-)
> 
> diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
> index 35559ead2..2096530ce 100644
> --- a/drivers/pci/vpd.c
> +++ b/drivers/pci/vpd.c
> @@ -403,13 +403,6 @@ static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj,
>  {
>  	struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj));
>  
> -	if (bin_attr->size > 0) {
> -		if (off > bin_attr->size)
> -			count = 0;
> -		else if (count > bin_attr->size - off)
> -			count = bin_attr->size - off;
> -	}
> -
>  	return pci_read_vpd(dev, off, count, buf);
>  }
>  
> @@ -419,13 +412,6 @@ static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj,
>  {
>  	struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj));
>  
> -	if (bin_attr->size > 0) {
> -		if (off > bin_attr->size)
> -			count = 0;
> -		else if (count > bin_attr->size - off)
> -			count = bin_attr->size - off;
> -	}
> -
>  	return pci_write_vpd(dev, off, count, buf);
>  }
>  
> -- 
> 2.30.0
> 

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

Krzysztof
diff mbox series

Patch

diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
index 35559ead2..2096530ce 100644
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -403,13 +403,6 @@  static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj,
 {
 	struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj));
 
-	if (bin_attr->size > 0) {
-		if (off > bin_attr->size)
-			count = 0;
-		else if (count > bin_attr->size - off)
-			count = bin_attr->size - off;
-	}
-
 	return pci_read_vpd(dev, off, count, buf);
 }
 
@@ -419,13 +412,6 @@  static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj,
 {
 	struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj));
 
-	if (bin_attr->size > 0) {
-		if (off > bin_attr->size)
-			count = 0;
-		else if (count > bin_attr->size - off)
-			count = bin_attr->size - off;
-	}
-
 	return pci_write_vpd(dev, off, count, buf);
 }