| 174 | } |
| 175 | |
| 176 | static int |
| 177 | smapi_probe (device_t dev) |
| 178 | { |
| 179 | struct resource *res; |
| 180 | int rid; |
| 181 | int error; |
| 182 | |
| 183 | error = 0; |
| 184 | rid = 0; |
| 185 | res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); |
| 186 | if (res == NULL) { |
| 187 | device_printf(dev, "Unable to allocate memory resource.\n"); |
| 188 | error = ENOMEM; |
| 189 | goto bad; |
| 190 | } |
| 191 | |
| 192 | if (smapi_header_cksum(RES2HDR(res))) { |
| 193 | device_printf(dev, "SMAPI header checksum failed.\n"); |
| 194 | error = ENXIO; |
| 195 | goto bad; |
| 196 | } |
| 197 | |
| 198 | bad: |
| 199 | if (res) |
| 200 | bus_release_resource(dev, SYS_RES_MEMORY, rid, res); |
| 201 | return (error); |
| 202 | } |
| 203 | |
| 204 | static int |
| 205 | smapi_attach (device_t dev) |
nothing calls this directly
no test coverage detected