Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ee5768b authored by zijunzhao's avatar zijunzhao Committed by Zijun Zhao
Browse files

Fix the error and make the argument nonnull

When trying to add nullability annotations to arguments in aosp/2381752,
conflicts come up.
See detail in https://android-build.googleplex.com/builds/pending/P47378145/aosp_bramble-userdebug/latest/view/logs/build_error.log

Bug: b/245972273
Test: atest mtp_ffs_handle_test
Change-Id: I841c57a404dbd0ee143257fe9106e3bcecbc8b3d
parent 2cd06f9d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -362,10 +362,12 @@ int MtpFfsHandle::waitEvents(struct io_buffer *buf, int min_events, struct io_ev

void MtpFfsHandle::cancelTransaction() {
    // Device cancels by stalling both bulk endpoints.
    if (::read(mBulkIn, nullptr, 0) != -1 || errno != EBADMSG)
    void *buf = malloc(sizeof(char));
    if (::read(mBulkIn, buf, 0) != -1 || errno != EBADMSG)
        PLOG(ERROR) << "Mtp stall failed on bulk in";
    if (::write(mBulkOut, nullptr, 0) != -1 || errno != EBADMSG)
    if (::write(mBulkOut, buf, 0) != -1 || errno != EBADMSG)
        PLOG(ERROR) << "Mtp stall failed on bulk out";
    free(buf);
    mCanceled = true;
    errno = ECANCELED;
}