Commit b19c19afa880105179b3c25e57b169c8fcda334c
Committed by
Dave Airlie
1 parent
966e0cdd50
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
drm: cope with platformdev->id == -1
If there are not multiple instances of a platform device, the id should apparently be set to -1. Which results in a odd looking bus-id like "platform:foodrm:-1". Probably we should just treat this case as id 0. Signed-off-by: Rob Clark <rob@ti.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Showing 1 changed file with 10 additions and 2 deletions Side-by-side Diff
drivers/gpu/drm/drm_platform.c
... | ... | @@ -122,7 +122,7 @@ |
122 | 122 | |
123 | 123 | static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master) |
124 | 124 | { |
125 | - int len, ret; | |
125 | + int len, ret, id; | |
126 | 126 | |
127 | 127 | master->unique_len = 13 + strlen(dev->platformdev->name); |
128 | 128 | master->unique_size = master->unique_len; |
129 | 129 | |
... | ... | @@ -131,8 +131,16 @@ |
131 | 131 | if (master->unique == NULL) |
132 | 132 | return -ENOMEM; |
133 | 133 | |
134 | + id = dev->platformdev->id; | |
135 | + | |
136 | + /* if only a single instance of the platform device, id will be | |
137 | + * set to -1.. use 0 instead to avoid a funny looking bus-id: | |
138 | + */ | |
139 | + if (id == -1) | |
140 | + id = 0; | |
141 | + | |
134 | 142 | len = snprintf(master->unique, master->unique_len, |
135 | - "platform:%s:%02d", dev->platformdev->name, dev->platformdev->id); | |
143 | + "platform:%s:%02d", dev->platformdev->name, id); | |
136 | 144 | |
137 | 145 | if (len > master->unique_len) { |
138 | 146 | DRM_ERROR("Unique buffer overflowed\n"); |