Commit d2cb4845 authored by Marcin Ciupak's avatar Marcin Ciupak Committed by Greg Kroah-Hartman

staging: pi433: fix (NULL device *) in log message

(NULL device *) is printed in log message in pi433_probe and
pi433_get_minor functions due to device->dev being used prior to call to
device_create function.
Signed-off-by: default avatarMarcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 57f8965a
...@@ -990,7 +990,7 @@ static int pi433_get_minor(struct pi433_device *device) ...@@ -990,7 +990,7 @@ static int pi433_get_minor(struct pi433_device *device)
device->minor = retval; device->minor = retval;
retval = 0; retval = 0;
} else if (retval == -ENOSPC) { } else if (retval == -ENOSPC) {
dev_err(device->dev, "too many pi433 devices\n"); dev_err(&device->spi->dev, "too many pi433 devices\n");
retval = -EINVAL; retval = -EINVAL;
} }
mutex_unlock(&minor_lock); mutex_unlock(&minor_lock);
...@@ -1098,19 +1098,10 @@ static int pi433_probe(struct spi_device *spi) ...@@ -1098,19 +1098,10 @@ static int pi433_probe(struct spi_device *spi)
SET_CHECKED(rf69_set_output_power_level (spi, 13)); SET_CHECKED(rf69_set_output_power_level (spi, 13));
SET_CHECKED(rf69_set_antenna_impedance (spi, fiftyOhm)); SET_CHECKED(rf69_set_antenna_impedance (spi, fiftyOhm));
/* start tx thread */
device->tx_task_struct = kthread_run(pi433_tx_thread,
device,
"pi433_tx_task");
if (IS_ERR(device->tx_task_struct)) {
dev_dbg(device->dev, "start of send thread failed");
goto send_thread_failed;
}
/* determ minor number */ /* determ minor number */
retval = pi433_get_minor(device); retval = pi433_get_minor(device);
if (retval) { if (retval) {
dev_dbg(device->dev, "get of minor number failed"); dev_dbg(&spi->dev, "get of minor number failed");
goto minor_failed; goto minor_failed;
} }
...@@ -1133,6 +1124,15 @@ static int pi433_probe(struct spi_device *spi) ...@@ -1133,6 +1124,15 @@ static int pi433_probe(struct spi_device *spi)
device->minor); device->minor);
} }
/* start tx thread */
device->tx_task_struct = kthread_run(pi433_tx_thread,
device,
"pi433_tx_task");
if (IS_ERR(device->tx_task_struct)) {
dev_dbg(device->dev, "start of send thread failed");
goto send_thread_failed;
}
/* create cdev */ /* create cdev */
device->cdev = cdev_alloc(); device->cdev = cdev_alloc();
device->cdev->owner = THIS_MODULE; device->cdev->owner = THIS_MODULE;
...@@ -1149,12 +1149,12 @@ static int pi433_probe(struct spi_device *spi) ...@@ -1149,12 +1149,12 @@ static int pi433_probe(struct spi_device *spi)
return 0; return 0;
cdev_failed: cdev_failed:
kthread_stop(device->tx_task_struct);
send_thread_failed:
device_destroy(pi433_class, device->devt); device_destroy(pi433_class, device->devt);
device_create_failed: device_create_failed:
pi433_free_minor(device); pi433_free_minor(device);
minor_failed: minor_failed:
kthread_stop(device->tx_task_struct);
send_thread_failed:
free_GPIOs(device); free_GPIOs(device);
GPIO_failed: GPIO_failed:
kfree(device); kfree(device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment