From patchwork Sun Oct 26 09:37:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 5153761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0467C9F818 for ; Sun, 26 Oct 2014 09:41:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E80C202FF for ; Sun, 26 Oct 2014 09:41:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4042A202D1 for ; Sun, 26 Oct 2014 09:41:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XiKH8-0002y9-10; Sun, 26 Oct 2014 09:38:14 +0000 Received: from mail-pa0-f41.google.com ([209.85.220.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XiKH5-0002xE-IW for linux-arm-kernel@lists.infradead.org; Sun, 26 Oct 2014 09:38:11 +0000 Received: by mail-pa0-f41.google.com with SMTP id rd3so3634767pab.28 for ; Sun, 26 Oct 2014 02:37:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=qtmedNcD6j4K1pSspqbOGxU+qQhRrDA5oi8TRn64KZU=; b=kENdhzgK4td+WtclqGZIrM8+ymsi64T/o7orOZf3v+A8HqXzix5EcUhtMItxrCh7Hg jRuMFbLn0UGLVFH3Vg12DpEw8ihUmSkoupTPMS4PwTb6tglwMOwQZcSqW9eMkEP3CdWD t3u7mKHw1v1DTM9FwRxRnvTawLdTc9ergKEwcGESHhJLfyCfUHaakv768vTRubk1a32q 0BET+6SeJQrh3RhpUVen/cvuZQQw1fBgN9LkaNA/oB7rj62ChI62w+AZnPu/eGDqGcNB gqSPHqTKOiwno87D8ODX8T2XSG71OylLvEKcyLNnhzs5y1muT4HfFJSMFToFwz/S9lvq a8cw== X-Gm-Message-State: ALoCoQlsB4b1iimhDLcTW2YTSsAAUk9cz4GcoYDKpSzCNUfo4j4DkorqYWX+NEa+PyreVwKe+2Qx X-Received: by 10.70.88.201 with SMTP id bi9mr9596002pdb.73.1414316268620; Sun, 26 Oct 2014 02:37:48 -0700 (PDT) Received: from [192.168.0.105] (218-164-141-238.dynamic.hinet.net. [218.164.141.238]) by mx.google.com with ESMTPSA id xf9sm8043342pab.2.2014.10.26.02.37.46 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sun, 26 Oct 2014 02:37:47 -0700 (PDT) Message-ID: <1414316264.4290.2.camel@phoenix> Subject: [PATCH 1/3] soc: ti: Use list_first_entry_or_null() at appropriate places From: Axel Lin To: Santosh Shilimkar Date: Sun, 26 Oct 2014 17:37:44 +0800 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141026_023811_630744_6D5089F6 X-CRM114-Status: GOOD ( 10.46 ) X-Spam-Score: -0.7 (/) Cc: Sandeep Nair , linux-arm-kernel , linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use list_first_entry_or_null() for first_region() and first_queue_range(). list_first_entry() expects the list is not empty, so first_region() and first_queue_range() never return NULL. Thus use list_first_entry_or_null() instead. Signed-off-by: Axel Lin --- drivers/soc/ti/knav_qmss.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/ti/knav_qmss.h b/drivers/soc/ti/knav_qmss.h index bc9dcc8..51da234 100644 --- a/drivers/soc/ti/knav_qmss.h +++ b/drivers/soc/ti/knav_qmss.h @@ -348,15 +348,15 @@ struct knav_range_info { list_for_each_entry(region, &kdev->regions, list) #define first_region(kdev) \ - list_first_entry(&kdev->regions, \ - struct knav_region, list) + list_first_entry_or_null(&kdev->regions, \ + struct knav_region, list) #define for_each_queue_range(kdev, range) \ list_for_each_entry(range, &kdev->queue_ranges, list) #define first_queue_range(kdev) \ - list_first_entry(&kdev->queue_ranges, \ - struct knav_range_info, list) + list_first_entry_or_null(&kdev->queue_ranges, \ + struct knav_range_info, list) #define for_each_pool(kdev, pool) \ list_for_each_entry(pool, &kdev->pools, list)