The code
Embedded Linux C. It compiles. There are 3 real bugs in it: the kind that pass a bench test and fail in the field.
static irqreturn_t tp_irq(int irq, void *dev)
{
struct tp *tp = dev;
mutex_lock(&tp->lock);
tp_read_points(tp); /* I2C transfer, sleeps */
mutex_unlock(&tp->lock);
return IRQ_HANDLED;
}
static int tp_setup_irq(struct tp *tp)
{
return request_irq(tp->irq, tp_irq,
IRQF_TRIGGER_LOW, "tp", tp);
}
static void tp_remove(struct tp *tp)
{
kfree(tp);
free_irq(tp->irq, tp);
}What an interviewer expects
- Point to each line you'd stop in a code review.
- Say what actually breaks: the failure mode, not just the rule it violates.
- Fix it, then defend the fix when asked the follow-up.
The bugs, reference fixes and the follow-up question are in the practice app, after you've tried it.
Companies that test this
Matched on the skills each company's embedded roles emphasise.
MedtronicMedical devices · India hiring: MediumTata ElxsiEngineering services · India hiring: HighAcsia TechnologiesEngineering services · India hiring: MediumAmazon devices (Lab126, Kuiper)Consumer devices · India hiring: MediumAMD IndiaChipmaker · India hiring: MediumAppleConsumer devices · India hiring: LowAptivAutomotive supplier · India hiring: MediumCapgemini EngineeringEngineering services · India hiring: High
Related challenges
Character driver read()Embedded Linux · Medium · 3 bugs · ~7 minSerial GPS reader on LinuxEmbedded Linux · Medium · 4 bugs · ~6 minPing diagnostic on a Linux gatewayEmbedded Linux · Medium · 3 bugs · ~6 minGPIO through /dev/memEmbedded Linux · Medium · 3 bugs · ~6 minADC over spidevEmbedded Linux · Medium · 3 bugs · ~6 min
Flag the lines, say what breaks, then fix it and build it with clang in your browser.
Find the bugs