Deleted Added
full compact
usb_template.c (302408) usb_template.c (305733)
1/* $FreeBSD: stable/11/sys/dev/usb/template/usb_template.c 298932 2016-05-02 17:44:03Z pfg $ */
1/* $FreeBSD: stable/11/sys/dev/usb/template/usb_template.c 305733 2016-09-12 10:14:30Z hselasky $ */
2/*-
3 * Copyright (c) 2007 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 1230 unchanged lines hidden (view full) ---

1240 uint8_t n;
1241 uint8_t do_unlock;
1242
1243 /* be NULL safe */
1244 if (tdd == NULL)
1245 return (0);
1246
1247 /* Protect scratch area */
2/*-
3 * Copyright (c) 2007 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 1230 unchanged lines hidden (view full) ---

1240 uint8_t n;
1241 uint8_t do_unlock;
1242
1243 /* be NULL safe */
1244 if (tdd == NULL)
1245 return (0);
1246
1247 /* Protect scratch area */
1248 do_unlock = usbd_enum_lock(udev);
1248 do_unlock = usbd_ctrl_lock(udev);
1249
1250 uts = udev->scratch.temp_setup;
1251
1252 memset(uts, 0, sizeof(*uts));
1253
1254 uts->usb_speed = udev->speed;
1255 uts->self_powered = udev->flags.self_powered;
1256

--- 62 unchanged lines hidden (view full) ---

1319 goto done;
1320 }
1321 }
1322done:
1323 error = uts->err;
1324 if (error)
1325 usb_temp_unsetup(udev);
1326 if (do_unlock)
1249
1250 uts = udev->scratch.temp_setup;
1251
1252 memset(uts, 0, sizeof(*uts));
1253
1254 uts->usb_speed = udev->speed;
1255 uts->self_powered = udev->flags.self_powered;
1256

--- 62 unchanged lines hidden (view full) ---

1319 goto done;
1320 }
1321 }
1322done:
1323 error = uts->err;
1324 if (error)
1325 usb_temp_unsetup(udev);
1326 if (do_unlock)
1327 usbd_enum_unlock(udev);
1327 usbd_ctrl_unlock(udev);
1328 return (error);
1329}
1330
1331/*------------------------------------------------------------------------*
1332 * usb_temp_unsetup
1333 *
1334 * This function frees any memory associated with the currently
1335 * setup template, if any.

--- 62 unchanged lines hidden ---
1328 return (error);
1329}
1330
1331/*------------------------------------------------------------------------*
1332 * usb_temp_unsetup
1333 *
1334 * This function frees any memory associated with the currently
1335 * setup template, if any.

--- 62 unchanged lines hidden ---