diff mbox

[1/3] soc: ti: Use list_first_entry_or_null() at appropriate places

Message ID 1414316264.4290.2.camel@phoenix (mailing list archive)
State New, archived
Headers show

Commit Message

Axel Lin Oct. 26, 2014, 9:37 a.m. UTC
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 <axel.lin@ingics.com>
---
 drivers/soc/ti/knav_qmss.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Santosh Shilimkar Oct. 27, 2014, 4:34 p.m. UTC | #1
Alex,

On 10/26/2014 02:37 AM, Axel Lin wrote:
> 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 <axel.lin@ingics.com>
> ---

Thanks. I will pick the $subject and other two patches and queue
them up for next merge window.

Regards,
Santosh
diff mbox

Patch

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)