Messages in this thread | | | Date | Mon, 4 May 2015 21:40:54 +0200 (CEST) | From | Thomas Gleixner <> | Subject | Re: [PATCH v2] x86: punit_atom: punit device state debug driver |
| |
On Mon, 4 May 2015, Srinivas Pandruvada wrote: > +struct punit_device { > + char *name; > + int reg; > + int sss_pos; > +}; > + > +static struct punit_device *punit_device;
So this pointer gets initialized in punit_atom_debug_init() and points either to punit_device_byt or punit_device_cht.
> +static const struct punit_device punit_device_byt[] = { > + { "GFX RENDER", PWRGT_STATUS, RENDER_POS }, ... > + { NULL } > +};
> +static int punit_dev_state_show(struct seq_file *seq_file, void *unused) > +{ > + u32 punit_pwr_status; > + int index; > + int status; > + > + seq_puts(seq_file, "\n\nPUNIT NORTH COMPLEX DEVICES :\n"); > + while (punit_device->name) { > + status = iosf_mbi_read(PUNIT_PORT, BT_MBI_PMC_READ, > + punit_device->reg, > + &punit_pwr_status); > + if (status) > + seq_printf(seq_file, "%9s : Read Failed\n", > + punit_device->name); > + else { > + index = (punit_pwr_status >> punit_device->sss_pos) & 3; > + seq_printf(seq_file, "%9s : %s\n", punit_device->name, > + dstates[index]); > + } > + punit_device++;
So you happily increment the above pointer. So after the first readout of that debug file the pointer will point to the end of that table. And any further readouts will simply fail.
Completely useless and untested crap.
Thanks,
tglx
| |