[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f816564f-5731-bfab-ef15-144ac7afc60f@axentia.se>
Date: Sat, 8 Jul 2017 23:00:39 +0200
From: Peter Rosin <peda@...ntia.se>
To: sathyanarayanan.kuppuswamy@...ux.intel.com
Cc: linux-kernel@...r.kernel.org, sathyaosid@...il.com
Subject: Re: [PATCH v2 1/1] mux: mux-core: Add NULL check for dev->of_node
On 2017-07-07 23:46, sathyanarayanan.kuppuswamy@...ux.intel.com wrote:
> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
>
> If dev->of_node is NULL, then calling mux_control_get()
> function can lead to NULL pointer exception. So adding
> a NULL check for dev->of_node.
>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
Do you have a driver that might call mux_control_get and not have any
of_node? If not, I don't see the point of this check.
Cheers,
peda
> ---
> drivers/mux/mux-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> Changes since v1:
> * Removed dummy new line.
>
> diff --git a/drivers/mux/mux-core.c b/drivers/mux/mux-core.c
> index 90b8995..924c983 100644
> --- a/drivers/mux/mux-core.c
> +++ b/drivers/mux/mux-core.c
> @@ -438,6 +438,9 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
> int index = 0;
> int ret;
>
> + if (!np)
> + return ERR_PTR(-ENODEV);
> +
> if (mux_name) {
> index = of_property_match_string(np, "mux-control-names",
> mux_name);
>
Powered by blists - more mailing lists