From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751976AbbEDTkx (ORCPT ); Mon, 4 May 2015 15:40:53 -0400 Received: from www.linutronix.de ([62.245.132.108]:46631 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbbEDTko (ORCPT ); Mon, 4 May 2015 15:40:44 -0400 Date: Mon, 4 May 2015 21:40:54 +0200 (CEST) From: Thomas Gleixner To: Srinivas Pandruvada cc: Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, LKML , pebolle@tiscali.nl Subject: Re: [PATCH v2] x86: punit_atom: punit device state debug driver In-Reply-To: <1430764259-16729-2-git-send-email-srinivas.pandruvada@linux.intel.com> Message-ID: References: <1430764259-16729-1-git-send-email-srinivas.pandruvada@linux.intel.com> <1430764259-16729-2-git-send-email-srinivas.pandruvada@linux.intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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