[PATCH] 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.
Signed-off-by: Thirupathaiah Annapureddy thiruan@linux.microsoft.com --- include/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/phy.h b/include/phy.h index 1dbbf65111..cbdb10d6fc 100644 --- a/include/phy.h +++ b/include/phy.h @@ -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; }

On 18. 08. 20 2:31, Thirupathaiah Annapureddy wrote:
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.
Signed-off-by: Thirupathaiah Annapureddy thiruan@linux.microsoft.com
include/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/phy.h b/include/phy.h index 1dbbf65111..cbdb10d6fc 100644 --- a/include/phy.h +++ b/include/phy.h @@ -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; }
Reviewed-by: Michal Simek michal.simek@xilinx.com
Thanks, Michal

Hi Tom,
út 18. 8. 2020 v 2:31 odesílatel Thirupathaiah Annapureddy thiruan@linux.microsoft.com napsal:
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.
Signed-off-by: Thirupathaiah Annapureddy thiruan@linux.microsoft.com
include/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/phy.h b/include/phy.h index 1dbbf65111..cbdb10d6fc 100644 --- a/include/phy.h +++ b/include/phy.h @@ -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; }
-- 2.25.2
Please also take this patch to your tree.
Thanks, Michal

On Tue, Sep 15, 2020 at 04:23:02PM +0200, Michal Simek wrote:
Hi Tom,
út 18. 8. 2020 v 2:31 odesílatel Thirupathaiah Annapureddy thiruan@linux.microsoft.com napsal:
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.
Signed-off-by: Thirupathaiah Annapureddy thiruan@linux.microsoft.com
include/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/phy.h b/include/phy.h index 1dbbf65111..cbdb10d6fc 100644 --- a/include/phy.h +++ b/include/phy.h @@ -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; }
-- 2.25.2
Please also take this patch to your tree.
OK, will do.

On Mon, Aug 17, 2020 at 05:31:08PM -0700, Thirupathaiah Annapureddy wrote:
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.
Signed-off-by: Thirupathaiah Annapureddy thiruan@linux.microsoft.com Reviewed-by: Michal Simek michal.simek@xilinx.com
Applied to u-boot/master, thanks!
participants (4)
-
Michal Simek
-
Michal Simek
-
Thirupathaiah Annapureddy
-
Tom Rini