From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754259AbcJKRcF (ORCPT ); Tue, 11 Oct 2016 13:32:05 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:40169 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753768AbcJKRcE (ORCPT ); Tue, 11 Oct 2016 13:32:04 -0400 Date: Tue, 11 Oct 2016 10:53:55 -0600 From: Jason Gunthorpe To: Jarkko Sakkinen Cc: Nayna , Peter Huewe , Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array Message-ID: <20161011165355.GB6881@obsidianresearch.com> References: <1475349926-476-1-git-send-email-jarkko.sakkinen@linux.intel.com> <1475349926-476-3-git-send-email-jarkko.sakkinen@linux.intel.com> <57FBE39B.2030301@linux.vnet.ibm.com> <20161011112315.GB21688@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161011112315.GB21688@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.151 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 11, 2016 at 02:23:15PM +0300, Jarkko Sakkinen wrote: > > >+ chip->bios_dir[cnt] = > > > securityfs_create_file("ascii_bios_measurements", > > >- S_IRUSR | S_IRGRP, tpm_dir, > > >+ S_IRUSR | S_IRGRP, chip->bios_dir[0], > > > (void *)&tpm_ascii_b_measurments_seqops, > > > &tpm_bios_measurements_ops); > > >+ if (is_bad(chip->bios_dir[cnt])) > > >+ goto err; > > >+err: > > >+ chip->bios_dir[cnt] = NULL; > > > > The updated patch looks fine. > > Just, I am not sure if NULL assignment is needed. > > It's not needed. It is required to switch an ERR_PTR to NULL, see is_bad() The original version that used a counter in chip did not need it. Jason