Skip to contentSkip to conversation

platform/chrome: null check create_singlethread_workqueue

PATCH In review Navid Emamdoost 2 participants 2 messages Sep 11, 2019 – Sep 19, 2019 Chrome hardware platform support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/chrome: null check create_singlethread_workqueue

In cros_usbpd_logger_probe the return value of create_singlethread_workqueue may be null, it should be checked.

---
 drivers/platform/chrome/cros_usbpd_logger.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/chrome/cros_usbpd_logger.c +3 -0
index 7c7b267626a0..c83397955cc3 100644
@@ -209,6 +209,9 @@ static int cros_usbpd_logger_probe(struct platform_device *pd)
 	/* Retrieve PD event logs periodically */
 	INIT_DELAYED_WORK(&logger->log_work, cros_usbpd_log_check);
 	logger->log_workqueue =	create_singlethread_workqueue("cros_usbpd_log");
+	if (!logger->log_workqueue)
+		return -ENOMEM;
+
 	queue_delayed_work(logger->log_workqueue, &logger->log_work,
 			   CROS_USBPD_LOG_UPDATE_DELAY);
 
Signature · 1 line
2.17.1
#1 lore raw

Hi,

Quoted 5 lines · Navid Emamdoost

In cros_usbpd_logger_probe the return value of create_singlethread_workqueue may be null, it should be checked.

---

Applied for 5.4, the patch went to linux-next some time ago, so sorry for late notice.

Thanks,
Enric

Quoted 18 lines
 drivers/platform/chrome/cros_usbpd_logger.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/chrome/cros_usbpd_logger.c +3 -0
index 7c7b267626a0..c83397955cc3 100644
@@ -209,6 +209,9 @@ static int cros_usbpd_logger_probe(struct platform_device *pd)
 	/* Retrieve PD event logs periodically */
 	INIT_DELAYED_WORK(&logger->log_work, cros_usbpd_log_check);
 	logger->log_workqueue =	create_singlethread_workqueue("cros_usbpd_log");
+	if (!logger->log_workqueue)
+		return -ENOMEM;
+
 	queue_delayed_work(logger->log_workqueue, &logger->log_work,
 			   CROS_USBPD_LOG_UPDATE_DELAY);