Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752389AbbLLRXu (ORCPT ); Sat, 12 Dec 2015 12:23:50 -0500 Received: from saturn.retrosnub.co.uk ([178.18.118.26]:56999 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbbLLRXt (ORCPT ); Sat, 12 Dec 2015 12:23:49 -0500 Subject: Re: [PATCH] iio/inkern.c Use list_for_each_entry_safe To: Anshul Garg , knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <1449596756-18133-1-git-send-email-aksgarg1989@gmail.com> From: Jonathan Cameron Message-ID: <566C5823.3040209@kernel.org> Date: Sat, 12 Dec 2015 17:23:47 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1449596756-18133-1-git-send-email-aksgarg1989@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1360 Lines: 41 On 08/12/15 17:45, Anshul Garg wrote: > Use list_for_each_entry_safe instead of list_for_each_safe > and list_entry call. > > Signed-off-by: Anshul Garg Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilder to play with it. Thanks, Jonathan > --- > drivers/iio/inkern.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c > index c8bad3c..f764eb6 100644 > --- a/drivers/iio/inkern.c > +++ b/drivers/iio/inkern.c > @@ -61,12 +61,10 @@ EXPORT_SYMBOL_GPL(iio_map_array_register); > int iio_map_array_unregister(struct iio_dev *indio_dev) > { > int ret = -ENODEV; > - struct iio_map_internal *mapi; > - struct list_head *pos, *tmp; > + struct iio_map_internal *mapi, *next; > > mutex_lock(&iio_map_list_lock); > - list_for_each_safe(pos, tmp, &iio_map_list) { > - mapi = list_entry(pos, struct iio_map_internal, l); > + list_for_each_entry_safe(mapi, next, &iio_map_list, l) { > if (indio_dev == mapi->indio_dev) { > list_del(&mapi->l); > kfree(mapi); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/