Skip to content

Commit

Permalink
i2c: mux: reg: wrong condition checked for of_address_to_resource ret…
Browse files Browse the repository at this point in the history
…urn value

of_address_to_resource return 0 on successful call but
devm_ioremap_resource is called only if it returns non-zero value

Signed-off-by: Lukasz Gemborowski <lukasz.gemborowski@nokia.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
  • Loading branch information
Lukasz Gemborowski authored and Wolfram Sang committed Jul 5, 2016
1 parent eab0998 commit 22ebf00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/muxes/i2c-mux-reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
mux->data.idle_in_use = true;

/* map address from "reg" if exists */
if (of_address_to_resource(np, 0, &res)) {
if (of_address_to_resource(np, 0, &res) == 0) {
mux->data.reg_size = resource_size(&res);
mux->data.reg = devm_ioremap_resource(&pdev->dev, &res);
if (IS_ERR(mux->data.reg))
Expand Down

0 comments on commit 22ebf00

Please sign in to comment.