[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF1780DAB383@HQMAIL01.nvidia.com>
Date: Fri, 20 Jan 2012 08:57:05 -0800
From: Stephen Warren <swarren@...dia.com>
To: Tony Lindgren <tony@...mide.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Linus Walleij <linus.walleij@...ricsson.com>,
Barry Song <21cnbao@...il.com>,
Haojian Zhuang <haojian.zhuang@...vell.com>,
Grant Likely <grant.likely@...retlab.ca>,
Thomas Abraham <thomas.abraham@...aro.org>,
Rajendra Nayak <rajendra.nayak@...aro.org>,
Dong Aisheng <dong.aisheng@...aro.org>,
Shawn Guo <shawn.guo@...escale.com>
Subject: RE: [PATCH 2/4] pinctrl: Fix pinmux_hog_maps when ctrl_dev_name is
not set
Tony Lindgren wrote at Friday, January 20, 2012 9:17 AM:
> The ctrl_dev_name is optional for struct pinmux_map assuming
> that ctrl_dev is set. Without this patch we can get:
>
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
> @@ -992,9 +992,12 @@ int pinmux_hog_maps(struct pinctrl_dev *pctldev)
>
> for (i = 0; i < pinmux_maps_num; i++) {
> struct pinmux_map const *map = &pinmux_maps[i];
> + int match_found = 0;
>
> - if (((map->ctrl_dev == dev) ||
> - !strcmp(map->ctrl_dev_name, devname)) &&
> + if (map->ctrl_dev_name && !strcmp(map->ctrl_dev_name, devname))
> + match_found = 1;
> +
> + if (((map->ctrl_dev == dev) || match_found) &&
> map->hog_on_boot) {
> /* OK time to hog! */
> ret = pinmux_hog_map(pctldev, map);
Wouldn't it be better if match_found was true for all matching cases,
in other words for the new code to be:
int match_found = 0;
if (map->ctrl_dev_name && !strcmp(map->ctrl_dev_name, devname))
match_found = 1;
if (map->ctrl_dev == dev)
match_found = 1;
if (match_found && map->hog_on_boot) {
--
nvpublic
Powered by blists - more mailing lists