aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/intel_th/core.c12
-rw-r--r--drivers/hwtracing/intel_th/intel_th.h3
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index db0691929a60..20339470c2c6 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -183,7 +183,11 @@ static DEVICE_ATTR_RO(port);
183 183
184static int intel_th_output_activate(struct intel_th_device *thdev) 184static int intel_th_output_activate(struct intel_th_device *thdev)
185{ 185{
186 struct intel_th_driver *thdrv = to_intel_th_driver(thdev->dev.driver); 186 struct intel_th_driver *thdrv =
187 to_intel_th_driver_or_null(thdev->dev.driver);
188
189 if (!thdrv)
190 return -ENODEV;
187 191
188 if (thdrv->activate) 192 if (thdrv->activate)
189 return thdrv->activate(thdev); 193 return thdrv->activate(thdev);
@@ -195,7 +199,11 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
195 199
196static void intel_th_output_deactivate(struct intel_th_device *thdev) 200static void intel_th_output_deactivate(struct intel_th_device *thdev)
197{ 201{
198 struct intel_th_driver *thdrv = to_intel_th_driver(thdev->dev.driver); 202 struct intel_th_driver *thdrv =
203 to_intel_th_driver_or_null(thdev->dev.driver);
204
205 if (!thdrv)
206 return;
199 207
200 if (thdrv->deactivate) 208 if (thdrv->deactivate)
201 thdrv->deactivate(thdev); 209 thdrv->deactivate(thdev);
diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h
index 15ebd48a29f2..0df22e30673d 100644
--- a/drivers/hwtracing/intel_th/intel_th.h
+++ b/drivers/hwtracing/intel_th/intel_th.h
@@ -151,6 +151,9 @@ struct intel_th_driver {
151#define to_intel_th_driver(_d) \ 151#define to_intel_th_driver(_d) \
152 container_of((_d), struct intel_th_driver, driver) 152 container_of((_d), struct intel_th_driver, driver)
153 153
154#define to_intel_th_driver_or_null(_d) \
155 ((_d) ? to_intel_th_driver(_d) : NULL)
156
154static inline struct intel_th_device * 157static inline struct intel_th_device *
155to_intel_th_hub(struct intel_th_device *thdev) 158to_intel_th_hub(struct intel_th_device *thdev)
156{ 159{