Skip to content

Commit 2e31e6f

Browse files
andy-shevmchehab
authored andcommitted
media: atomisp: Make pointer to PMIC client global
When we enumerate second device when PMIC has been successfully detected to AXP, we got into troubles dereferencing NULL pointer. It seems we have to detect PMIC only once because pmic_id is a global variable and code doesn't expect the change of it: Two PMICs on one platform? It's impossible. Crash excerpt: [ 34.335237] BUG: kernel NULL pointer dereference, address: 0000000000000002 ... [ 35.652036] RIP: 0010:gmin_subdev_add.cold+0x32f/0x33e [atomisp_gmin_platform] So, as a quick fix make power a global variable. In next patches we move PMIC detection to be more independent from subdevices. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 0f46ab4 commit 2e31e6f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,11 @@ static int atomisp_get_acpi_power(struct device *dev, acpi_handle handle)
482482
return clock_num;
483483
}
484484

485+
static struct i2c_client *power;
486+
485487
static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
486488
{
487-
struct i2c_client *power = NULL, *client = v4l2_get_subdevdata(subdev);
489+
struct i2c_client *client = v4l2_get_subdevdata(subdev);
488490
struct acpi_device *adev;
489491
struct gmin_subdev *gs;
490492
acpi_handle handle;
@@ -696,7 +698,6 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
696698
gs->eldo2_ctrl_shift = gmin_get_var_int(dev, false,
697699
"eldo2_ctrl_shift",
698700
ELDO2_CTRL_SHIFT);
699-
gs->pwm_i2c_addr = power->addr;
700701
break;
701702

702703
default:

0 commit comments

Comments
 (0)