Skip to content

Commit

Permalink
staging: ti-st: fix kim platform device id
Browse files Browse the repository at this point in the history
Platform devices tend to have id as -1 when only 1 device exist and
a value >=0 when multiple devices exist, since we plan to store all
these platform devices if multiple exist, there was a requirement to
have id to be >=0.
The patch fixes this problem.

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Pavan Savoy authored and Greg Kroah-Hartman committed Sep 16, 2010
1 parent 48c51a8 commit dfb7ef7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/staging/ti-st/st_kim.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,14 @@ static int kim_probe(struct platform_device *pdev)
long *gpios = pdev->dev.platform_data;
struct kim_data_s *kim_gdata;

st_kim_devices[pdev->id] = pdev;
if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
/* multiple devices could exist */
st_kim_devices[pdev->id] = pdev;
} else {
/* platform's sure about existance of 1 device */
st_kim_devices[0] = pdev;
}

kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
if (!kim_gdata) {
pr_err("no mem to allocate");
Expand Down

0 comments on commit dfb7ef7

Please sign in to comment.