Commit dfb7ef7d authored by Pavan Savoy's avatar Pavan Savoy Committed by Greg Kroah-Hartman
Browse files

staging: ti-st: fix kim platform device id



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: default avatarPavan Savoy <pavan_savoy@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 48c51a8c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -638,7 +638,14 @@ static int kim_probe(struct platform_device *pdev)
	long *gpios = pdev->dev.platform_data;
	struct kim_data_s	*kim_gdata;

	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");