PPS is not really the must-have subsystem that warrants crashing
the machine if the ldisc interface is broken.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: George Spelvin <linux@horizon.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
#include <linux/serial_core.h>
#include <linux/tty.h>
#include <linux/pps_kernel.h>
#include <linux/serial_core.h>
#include <linux/tty.h>
#include <linux/pps_kernel.h>
#define PPS_TTY_MAGIC 0x0001
#define PPS_TTY_MAGIC 0x0001
{
struct pps_device *pps = pps_lookup_dev(tty);
{
struct pps_device *pps = pps_lookup_dev(tty);
+ /*
+ * This should never fail, but the ldisc locking is very
+ * convoluted, so don't crash just in case.
+ */
+ if (WARN_ON_ONCE(pps == NULL))
+ return;
/* Now do the PPS event report */
pps_event(pps, ts, status ? PPS_CAPTUREASSERT :
/* Now do the PPS event report */
pps_event(pps, ts, status ? PPS_CAPTUREASSERT :
+ if (WARN_ON(!pps))
+ return;
+
dev_info(pps->dev, "removed\n");
pps_unregister_source(pps);
}
dev_info(pps->dev, "removed\n");
pps_unregister_source(pps);
}