[openwrt/openwrt] generic: fix wrong PTR_ERR use in of net mac address ascii patch

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 12 17:07:20 PST 2022


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/c3c9ef598cd03a05e24a85d1dcbd26db70df01d0

commit c3c9ef598cd03a05e24a85d1dcbd26db70df01d0
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Tue Dec 13 00:15:28 2022 +0100

    generic: fix wrong PTR_ERR use in of net mac address ascii patch
    
    nvmem_cell_read return a pointer error when an error occurs. Currently
    we convert the pointer error to an int while the rest of the function
    return a void* and expcet an error pointer. Fix this PTR_ERR msuse
    fixing compilation warning.
    
    Fixes the following compilation warning:
    net/ethernet/eth.c: In function 'nvmem_cell_get_mac_address':
    net/ethernet/eth.c:547:24: warning: returning 'long int' from a function with return type 'void *' makes pointer from integer without a cast [-Wint-conversion]
      547 |                 return PTR_ERR(mac);
          |                        ^~~~~~~~~~~~
    net/ethernet/eth.c: In function 'nvmem_cell_get_mac_address_ascii':
    net/ethernet/eth.c:564:24: warning: returning 'long int' from a function with return type 'void *' makes pointer from integer without a cast [-Wint-conversion]
      564 |                 return PTR_ERR(mac_ascii);
          |                        ^~~~~~~~~~~~~~~~~~
    
    Fixes: 7b863af180da ("kernel: move mac-address-ascii patches to generic")
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 .../generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch  | 4 ++--
 .../generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch
index f73e262bba..5dd70f5f71 100644
--- a/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch
+++ b/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch
@@ -22,7 +22,7 @@ Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
 +
 +	mac = nvmem_cell_read(cell, &len);
 +	if (IS_ERR(mac))
-+		return PTR_ERR(mac);
++		return mac;
 +	if (len != ETH_ALEN) {
 +		kfree(mac);
 +		return ERR_PTR(-EINVAL);
@@ -39,7 +39,7 @@ Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
 +
 +	mac_ascii = nvmem_cell_read(cell, &len);
 +	if (IS_ERR(mac_ascii))
-+		return PTR_ERR(mac_ascii);
++		return mac_ascii;
 +	if (len != ETH_ALEN*2+5) {
 +		kfree(mac_ascii);
 +		return ERR_PTR(-EINVAL);
diff --git a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
index 83483751f8..4ab05b4ea6 100644
--- a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
+++ b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch
@@ -22,7 +22,7 @@ Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
 +
 +	mac = nvmem_cell_read(cell, &len);
 +	if (IS_ERR(mac))
-+		return PTR_ERR(mac);
++		return mac;
 +	if (len != ETH_ALEN) {
 +		kfree(mac);
 +		return ERR_PTR(-EINVAL);
@@ -39,7 +39,7 @@ Submitted-by: Yousong Zhou <yszhou4tech at gmail.com>
 +
 +	mac_ascii = nvmem_cell_read(cell, &len);
 +	if (IS_ERR(mac_ascii))
-+		return PTR_ERR(mac_ascii);
++		return mac_ascii;
 +	if (len != ETH_ALEN*2+5) {
 +		kfree(mac_ascii);
 +		return ERR_PTR(-EINVAL);




More information about the lede-commits mailing list