diff mbox series

pinctrl: imx: remove an unnecessary NULL check

Message ID 20190328144022.GO32613@kadam
State New
Headers show
Series pinctrl: imx: remove an unnecessary NULL check | expand

Commit Message

Dan Carpenter March 28, 2019, 2:40 p.m. UTC
The address of "ipctl->pin_regs[pin_id]" can't be NULL.  It's the offset
into an array in the middle of a struct.  This patch removes the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dong Aisheng March 29, 2019, 10:20 a.m. UTC | #1
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Thursday, March 28, 2019 10:40 PM
> 
> The address of "ipctl->pin_regs[pin_id]" can't be NULL.  It's the offset into an
> array in the middle of a struct.  This patch removes the check.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Dong Aisheng

> ---
>  drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c
> b/drivers/pinctrl/freescale/pinctrl-imx.c
> index 188001beb298..d2d4b8ffc08d 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx.c
> +++ b/drivers/pinctrl/freescale/pinctrl-imx.c
> @@ -449,7 +449,7 @@ static void imx_pinconf_dbg_show(struct pinctrl_dev
> *pctldev,
>  		}
>  	} else {
>  		pin_reg = &ipctl->pin_regs[pin_id];
> -		if (!pin_reg || pin_reg->conf_reg == -1) {
> +		if (pin_reg->conf_reg == -1) {
>  			seq_puts(s, "N/A");
>  			return;
>  		}
> --
> 2.17.1
Linus Walleij April 8, 2019, 11:07 a.m. UTC | #2
On Thu, Mar 28, 2019 at 3:40 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The address of "ipctl->pin_regs[pin_id]" can't be NULL.  It's the offset
> into an array in the middle of a struct.  This patch removes the check.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied with Dong's ACK!

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 188001beb298..d2d4b8ffc08d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -449,7 +449,7 @@  static void imx_pinconf_dbg_show(struct pinctrl_dev *pctldev,
 		}
 	} else {
 		pin_reg = &ipctl->pin_regs[pin_id];
-		if (!pin_reg || pin_reg->conf_reg == -1) {
+		if (pin_reg->conf_reg == -1) {
 			seq_puts(s, "N/A");
 			return;
 		}