summaryrefslogtreecommitdiffstats
path: root/drivers/ptp
diff options
context:
space:
mode:
authorJonathan Lemon <jonathan.lemon@gmail.com>2021-09-14 19:16:21 -0700
committerDavid S. Miller <davem@davemloft.net>2021-09-15 11:10:00 +0100
commit1447149d653934dea868d22d00d7b5f1b86ef70b (patch)
tree79e34272da9d54cac03ab505ccc6e8756852dfa8 /drivers/ptp
parent498ad3f4389a1f1d2b0e09fa8f906152b0cfaf67 (diff)
downloadlinux-1447149d653934dea868d22d00d7b5f1b86ef70b.tar.bz2
ptp: ocp: Skip I2C flash read when there is no controller.
If an I2C controller isn't present, don't try and read the I2C flash. Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_ocp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 2a6cc762c60e..196a457929f0 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -228,8 +228,8 @@ static int ptp_ocp_ts_enable(void *priv, bool enable);
* 3: GPS
* 4: GPS2 (n/c)
* 5: MAC
- * 6: SPI IMU (inertial measurement unit)
- * 7: I2C oscillator
+ * 6: N/C
+ * 7: I2C controller
* 8: HWICAP
* 9: SPI Flash
*/
@@ -706,6 +706,9 @@ ptp_ocp_get_serial_number(struct ptp_ocp *bp)
struct device *dev;
int err;
+ if (!bp->i2c_ctrl)
+ return;
+
dev = device_find_child(&bp->i2c_ctrl->dev, NULL, ptp_ocp_firstchild);
if (!dev) {
dev_err(&bp->pdev->dev, "Can't find I2C adapter\n");