Select callers of iqs7222_parse_props() do not expect a child node
to be derived and returned via pointer. As such, these callers set
**child_node to NULL. However, this pointer is dereferenced in all
cases.
To solve this problem, dereference the pointer only for cases that
expect a child node in the first place. In these cases, the caller
provides a valid pointer.
Fixes: 27eaac94c6be ("Input: add support for Azoteq IQS7222A/B/C")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/20220417214132.497487-1-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
enum iqs7222_reg_key_id reg_key)
{
u16 *setup = iqs7222_setup(iqs7222, reg_grp, child_index);
- struct fwnode_handle *reg_grp_node = *child_node;
struct i2c_client *client = iqs7222->client;
+ struct fwnode_handle *reg_grp_node;
char reg_grp_name[16];
int i;
* for additional group-specific processing. In some cases, the
* child node may have already been derived.
*/
- if (*child_node)
+ reg_grp_node = *child_node;
+ if (reg_grp_node)
break;
snprintf(reg_grp_name, sizeof(reg_grp_name), "%s-%d",