Skip to contentSkip to conversation

include: phy: fix NULL pointer check in phy_write()

PATCH New Thirupathaiah Annapureddy 4 participants 5 messages Aug 18, 2020 – Sep 17, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include: phy: fix NULL pointer check in phy_write()

phy_write() uses bus->write() instead of bus->read(). This means NULL pointer pre-check needs to happen on bus->write instead of bus->read.

---
 include/phy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy.h +1 -1
index 1dbbf65111..cbdb10d6fc 100644
@@ -205,7 +205,7 @@ static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
 {
 	struct mii_dev *bus = phydev->bus;
 
-	if (!bus || !bus->read) {
+	if (!bus || !bus->write) {
 		debug("%s: No bus configured\n", __func__);
 		return -1;
 	}
Signature · 1 line
2.25.2
#1 lore raw

PATCH 1/1 include: phy: fix NULL pointer check in phy_write()

Quoted 14 lines · Thirupathaiah Annapureddy

phy_write() uses bus->write() instead of bus->read(). This means NULL pointer pre-check needs to happen on bus->write instead of bus->read.

---
 include/phy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy.h +0 -0
index 1dbbf65111..cbdb10d6fc 100644

include/phy.h static inline int phy_write(struct phy_device *phydev, int devad, int regnum, · line 211

Quoted 8 lines
include/phy.h +1 -1
@@ -205,7 +205,7 @@ static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
 {
 	struct mii_dev *bus = phydev->bus;
 
-	if (!bus || !bus->read) {
+	if (!bus || !bus->write) {
 		debug("%s: No bus configured\n", __func__);
 		return -1;
 	}

Thanks,
Michal

#2 lore raw

PATCH 1/1 include: phy: fix NULL pointer check in phy_write()

In reply to Thirupathaiah Annapureddy

Hi Tom,

?t 18. 8. 2020 v 2:31 odes?latel Thirupathaiah Annapureddy <[email protected]> napsal:

Quoted 23 lines

phy_write() uses bus->write() instead of bus->read(). This means NULL pointer pre-check needs to happen on bus->write instead of bus->read.

---
 include/phy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy.h +1 -2
index 1dbbf65111..cbdb10d6fc 100644
@@ -205,7 +205,7 @@ static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
 {
        struct mii_dev *bus = phydev->bus;
 
-       if (!bus || !bus->read) {
+       if (!bus || !bus->write) {
                debug("%s: No bus configured\n", __func__);
                return -1;
        }
--
Quoted 2 lines

2.25.2

Please also take this patch to your tree.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
#3 lore raw

PATCH 1/1 include: phy: fix NULL pointer check in phy_write()

Quoted 21 lines · Michal Simek

Hi Tom,

?t 18. 8. 2020 v 2:31 odes?latel Thirupathaiah Annapureddy <[email protected]> napsal:

Quoted 17 lines

phy_write() uses bus->write() instead of bus->read(). This means NULL pointer pre-check needs to happen on bus->write instead of bus->read.

---
 include/phy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy.h +0 -0
index 1dbbf65111..cbdb10d6fc 100644
@@ -205,7 +205,7 @@ static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
 {
        struct mii_dev *bus = phydev->bus;
 
Quoted 10 lines
Quoted 8 lines
include/phy.h +1 -2
-       if (!bus || !bus->read) {
+       if (!bus || !bus->write) {
                debug("%s: No bus configured\n", __func__);
                return -1;
        }
--

2.25.2

Please also take this patch to your tree.

OK, will do.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200915/bf61aa7a/attachment.sig>
#4 lore raw

PATCH 1/1 include: phy: fix NULL pointer check in phy_write()

In reply to Thirupathaiah Annapureddy
Quoted 5 lines · Thirupathaiah Annapureddy

phy_write() uses bus->write() instead of bus->read(). This means NULL pointer pre-check needs to happen on bus->write instead of bus->read.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200917/3076d1f9/attachment.sig>