coresight: cti: remove incorrect NULL return check
diff mbox series

Message ID 20200505134020.11148-1-calvin.johnson@oss.nxp.com
State Superseded
Headers show
Series
  • coresight: cti: remove incorrect NULL return check
Related show

Commit Message

Calvin Johnson May 5, 2020, 1:40 p.m. UTC
fwnode_find_reference() doesn't return NULL and hence that check
should be avoided.

Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
---

 drivers/hwtracing/coresight/coresight-cti-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mathieu Poirier May 6, 2020, 5:05 p.m. UTC | #1
On Tue, May 05, 2020 at 07:10:20PM +0530, Calvin Johnson wrote:
> fwnode_find_reference() doesn't return NULL and hence that check
> should be avoided.
> 
> Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
> ---
> 
>  drivers/hwtracing/coresight/coresight-cti-platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index b44d83142b62..2fdaeec80ee5 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -120,7 +120,7 @@ static int cti_plat_create_v8_etm_connection(struct device *dev,
>  
>  	/* Can optionally have an etm node - return if not  */
>  	cs_fwnode = fwnode_find_reference(root_fwnode, CTI_DT_CSDEV_ASSOC, 0);
> -	if (IS_ERR_OR_NULL(cs_fwnode))
> +	if (IS_ERR(cs_fwnode))
>  		return 0;
>  
>  	/* allocate memory */
> @@ -393,7 +393,7 @@ static int cti_plat_create_connection(struct device *dev,
>  		/* associated device ? */
>  		cs_fwnode = fwnode_find_reference(fwnode,
>  						  CTI_DT_CSDEV_ASSOC, 0);
> -		if (!IS_ERR_OR_NULL(cs_fwnode)) {
> +		if (!IS_ERR(cs_fwnode)) {
>  			assoc_name = cti_plat_get_csdev_or_node_name(cs_fwnode,
>  								     &csdev);

You are correct.

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Greg, can you pick this up as a fix for 5.7?

Thanks,
Mathieu

>  			fwnode_handle_put(cs_fwnode);
> -- 
> 2.17.1
>

Patch
diff mbox series

diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
index b44d83142b62..2fdaeec80ee5 100644
--- a/drivers/hwtracing/coresight/coresight-cti-platform.c
+++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
@@ -120,7 +120,7 @@  static int cti_plat_create_v8_etm_connection(struct device *dev,
 
 	/* Can optionally have an etm node - return if not  */
 	cs_fwnode = fwnode_find_reference(root_fwnode, CTI_DT_CSDEV_ASSOC, 0);
-	if (IS_ERR_OR_NULL(cs_fwnode))
+	if (IS_ERR(cs_fwnode))
 		return 0;
 
 	/* allocate memory */
@@ -393,7 +393,7 @@  static int cti_plat_create_connection(struct device *dev,
 		/* associated device ? */
 		cs_fwnode = fwnode_find_reference(fwnode,
 						  CTI_DT_CSDEV_ASSOC, 0);
-		if (!IS_ERR_OR_NULL(cs_fwnode)) {
+		if (!IS_ERR(cs_fwnode)) {
 			assoc_name = cti_plat_get_csdev_or_node_name(cs_fwnode,
 								     &csdev);
 			fwnode_handle_put(cs_fwnode);