[U-Boot] [PATCH v4 03/20] env: Consolidate common code in hsearch_r()