inorct - 1;
141 int new_min = baseminor;
142 int new_max = baseminor + minorct - 1;
143
144 /* New driver overlaps from the left. */
145 if (new_max >= old_min && new_max <= old_max) {
146 ret = -EBUSY;
147 goto out;
148 }
149
150 /* New driver overlaps from the right. */
151 if (new_min <= old_max && new_min >= old_min) {
152 ret = -EBUSY;
153 goto out;
154 }
155 }
156
157 cd->next = *cp;
158 *cp = cd;
159 mutex_unlock(&chrdevs_lock);
160 return cd;
161out:
162 mutex_unlock(&chrdevs_lock);
163 kfree(cd);
164 return ERR_PTR(ret);
165}
|